none
global.RenderFormat in rdl2008

    Question

  • Hi,

    I have a Report template (rdlc) and use it in my Webapplication.
    I've to do some custom formatting on excel export (i.E disable hyperlinks).
    Report Definition Language 2010 supports the global variable RenderFormat to distinguish between the different Renderer (Html, Excel etc).
    Unfortunately rdl2010 is not yet supported for client-processed reports.
    Is there any other solution to distinguish between the different renderer in expressions when using rdl2008?

    I'd really appreciate your help.

    Philipp
    Wednesday, October 27, 2010 3:44 PM

Answers

  • I've found a solution to solve the  problem.

    I changed the application to invoke the excel export outside the reportviewer by a button. In the button-eventhandler the following code is used.

                ReportViewer.LocalReport.SetParameters(new ReportParameter("Renderer""Excel"));


                string reportType = "EXCEL";
                string mimeType;
                string encoding;
                string fileNameExtension;

                Warning[] warnings;
                string[] streams;
                byte[] renderedBytes;

                //The DeviceInfo settings should be changed based on the reportType
                //http://msdn2.microsoft.com/en-us/library/ms155397.aspx
                string deviceInfo =
                "<DeviceInfo>" +
                "</DeviceInfo>";

                //Render the report
                renderedBytes = ReportViewer.LocalReport.Render(
                    reportType,
                    deviceInfo,
                    out mimeType,
                    out encoding,
                    out fileNameExtension,
                    out streams,
                    out warnings);

                //Clear the response stream and write the bytes to the outputstream
                //Set content-disposition to "attachment" so that user is prompted to take an action
                //on the file (open or save)
                Response.Clear();
                Response.ContentType = mimeType;
                Response.AddHeader("content-disposition""attachment; filename=foo." + fileNameExtension);
                Response.BinaryWrite(renderedBytes);
                Response.End();

    I don't know if it is the best solution, but it works for my requirement. 

    • Marked as answer by Phipu1 Thursday, October 28, 2010 6:42 AM
    Thursday, October 28, 2010 6:42 AM