SSRS 2008 R2 Globals!RenderFormat export methods

后端 未结 3 1743
星月不相逢
星月不相逢 2021-01-14 13:28

There are 7 built in options for exporting SSRS 2008 reports.

I was wondering if there is an easier way to code the following in SSRS when chosing the export option:

相关标签:
3条回答
  • 2021-01-14 13:49

    Use "RPL" for a simpler IIF expression so that any other format is "EXCEL", "CSV", "WORD", etc. When the report is displayed in the report server viewer or a ReportViewer control the RenderFormat is "RPL".

        =IIF(Globals!RenderFormat.Name = "RPL", true, false)
    

    The above code when set as a visibility expression will show the field when rendered in SSRS and hide it on export.

    Tip: When you have a long IIF expression use a switch expression Reporting Services Expression Examples they are by far cleaner and easier to manage.

    0 讨论(0)
  • 2021-01-14 13:49

    The expression below, placed in the Column Visibility dialog box for a selected column, displays the column only when the report is exported to Excel; otherwise, the column is hidden.

    =IIF(Globals!RenderFormat.Name = "EXCELOPENXML" OR Globals!RenderFormat.Name = "EXCEL", false, true)
    

    This is mentioned in the MSDN itself. Hence it does work!

    0 讨论(0)
  • 2021-01-14 14:14

    The suggestion from ShellNinja won't work as a visibility expression because of the order in which expressions and other report items are processed and rendered.

    The article Built-in Globals and Users References on TechNet hints at this (allbeit a very vague hint) under the RenderFormat subheading where it says that:

    Globals!RenderFormat.Name is available during specific parts of the report processing/rendering cycle.

    Globals!RenderFormat.Name is not populated prior to expressions being evaluated, it's populated on completion of the current render request which is why it can't be used in a visibility expression but will display the name in a textbox.

    Globals!RenderFormat.IsInteractive is populated prior to expression evaluation and is the only way of hiding/showing a report item prior to a report being rendered. RPL and HTML are considered fully interactive formats, all other formats are not or only support some interactive features. More information on this can be found in the article Comparing Interactive Functionality for Different Report Rendering Extensions on TechNet.

    0 讨论(0)
提交回复
热议问题