简体   繁体   中英

Reporting Services - Rendering to Excel in C# WinForm

I have a WinForms application that can call for and display a number of reporting services reports. I can call the

LocalReport.Render("Excel", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings); 

method - writing to a byte[] array, but it throws an exception

The source of the report definition has not been specified.

Does anyone know how to solve this?

Use the following param for the 2nd parameter.

<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>

And you need to setup the report with something like:

var MyInfo = MyRS.LoadReport("/" + reportPath, null);
var ReportDeviceInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
String ExtensionValue = String.Empty;
String EncodingValue = String.Empty;
String MimeTypeValue = String.Empty;
Warning[] WarningValue = null;
String[] StreamIDsValue = null;

var Result = MyRS.Render("Excel", ReportDeviceInfo, out ExtensionValue, out EncodingValue, out MimeTypeValue, out WarningValue, out StreamIDsValue);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM