rdlc导出excel分页数据量超过65536报错怎么办?

Reporting Services in Local Mode


rdlc在设计时,如果要将DateTime类型的字段展示成x年y月z日,那么需要使用格式化字符串的函数,但是格式枚举会有问题,它总显示一个红色波浪线, 代表这个脚本有问题,可是实际上,在msdn中查询出来的任意格式枚举都不会有错误,显示效果是正常的,这个算是一个假警报。


rdlc在使用自带的导出功能时,当数据量超过65536时,它无法像水晶报表一样自动增加sheet,这个不知道是轻量级控件的设计局限还是微软忘记了做。
问题是,有办法解决么?有补丁也成啊.

http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/6fbc5ce8-96f7-4084-9053-b1c570092022

http://wenda.tianya.cn/wenda/thread?tid=10cf3f307827eb1a

Rendering .rdlc to Excel in Firefox on Mac

Richar posted on Tuesday, August 05, 2008 4:20 PM

I'm rendering a localreport to Excel. Works fine in IE and Firefox on a PC,
but Excel can't open it on the Mac. I found KB article 918529 at
http://support.microsoft.com/kb/918529 that somewhat describes the problem
for an SSRS 2005 server report, but I'm not using SSRS to render a server
report, it's a .rdlc.

The article said that the Microsoft.ReportingServices.ExcelRendering.dll is
modified by the hotfix/sp2. I installed SP2 for SS, but I'm not sure how to
proceed from here. I copied this dll on our server in the bin folder of our
web application (the file wasn't part of our solution before), but users on a
Mac still cannot view the report (Excel just hangs trying to open it).

Any help would be greatly appreciated. Here is the export part of my code
(Asp.Net 2.0):

private void Export(LocalReport report, string format)

{
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string extension;
string deviceInfo;
string contentType;

switch (format)
{

case "PDF":

deviceInfo =
contentType = "application/pdf";
break;

case "EXCEL":

deviceInfo =

contentType = "application/vnd.ms-excel";
break;

default:
deviceInfo =

contentType = "application/pdf";
break;
}

byte[] bytes = report.Render(format, deviceInfo, out mimeType, out encoding,
out extension, out streamids, out warnings);

HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.ContentType = contentType;

if(format == "EXCEL")
HttpContext.Current.Response.AddHeader("Content-disposition", "attachment;
filename=MyReport.xls");

HttpContext.Current.Response.BinaryWrite(bytes);
HttpContext.Current.Response.End();
}
http://www.eggheadcafe.com/software/aspnet/32822202/rendering-rdlc-to-excel.aspx
 

(Server/Remote Mode)

Select Do not timeout report execution in Report Execution Timeout settings in your system

Path is http://<Machine Name>/Reports/Pages/Settings.aspx

And you cant export more than 65K Rows in one report

 

It seems that your report is quite big as dimensions  (37000 rows x 182 columns), and it should be mentioned here that not only the dimensions of the report are important, but also the complexity. 

I found this post that talks about similar performance issues for Excel renderer:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3474787&SiteID=1

To avoid being timeout during rendering a report, I would suggest to do this:

- go to Report Manager and render the report

- select Properties - Execution  and from the section Report Execution Timeout choose the option:

Do not timeout report execution

Go to your report, right click on the detail row, and select "Insert Group".  In the "Grouping and Sorting Properties" dialog box, put this in for the expression:  =Int((RowNumber(Nothing) - 1) / 65000)

The 65000 is how many records will be on each sheet when exported to Excel.  Then, check the box, "Page break at end".  Re-run and export your report to Excel, you will have a sheet for each 65000 records.

原文地址:https://www.cnblogs.com/emanlee/p/1669413.html