开发者

Hide image on report (RDLC) based upon report render method

We have some reports that are loaded on a asp.net webpage via the localreport.render() and a request has come in to hide a logo image if it is displayed inline as html on the page and only show the image if it's rendered as a pdf.

is there any way to determine the render mode in the report so i can create an expression to set the display property to hidden for the logo image if it's not pdf mode?

I've been searching google and msdn with no l开发者_C百科uck.

thanks!


What version of SSRS are you using? If you are using SQL Server Reporting Services 2008 R2 I think you are in luck. Check out the link below, he explains how to do what you are asking but the opposite ( display the image in HTML but NOT int PDF ). I'm sure you could just reverse the logic...

http://www.mssqltips.com/tip.asp?tip=2106

The Hidden expression for the image would be...

=Globals!RenderFormat.IsInteractive

This would evaluate to Hidden=true for HTML and Hidden=false for PDF since PDF is considered non-interactive in this context.


Here is what I did to accomplish something similar:

I used the ReportViewer.LocalReport.Render method to render the report to Excel, PDF, etc. and manually streamed that back to the user for download. In order for the report to determine if it is being exported I simply set a parameter before the export and reset the parameter after the export. Something like this:

reportViewerMain.LocalReport.SetParameters(new ReportParameter("IsExporting", "true"));
byte[] bytes = reportViewerMain.LocalReport.Render("Excel");
reportViewerMain.LocalReport.SetParameters(new ReportParameter("IsExporting", "false"));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜