Reporting Services - 使用C#WinForm呈现到Excel

时间:2021-08-14 08:08:49

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

我有一个WinForms应用程序,可以调用并显示一些报告服务报告。我可以打电话给

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

方法 - 写入byte []数组,但它会抛出异常

The source of the report definition has not been specified.

尚未指定报告定义的来源。

Does anyone know how to solve this?

有谁知道如何解决这个问题?

1 个解决方案

#1


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);

#1


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);