【问题标题】:Report viewer throws out of memory exception error while exporting to excel报告查看器在导出到 excel 时抛出内存不足异常错误
【发布时间】:2018-01-14 21:01:05
【问题描述】:
抛出内存不足异常 - 我尝试将大型记录从报表查看器导出到 Windows 窗体中的 excel 中。由于 excel 不允许超过 65535 行,因此我已对分页符应用分组。下面的表达式用于 Group On 表达式,
=Int((RowNumber(Nothing))/10000)
Page Break at end Checkbox is enabled for this grouping
通过单击报表查看器控件中可用的默认导出选项进行导出时。但是导致内存不足异常抛出。
我做得对吗?有什么解决方案或解决方法吗?
提前致谢,
【问题讨论】:
标签:
winforms
reporting-services
ssrs-2008
rdlc
reportviewer2008
【解决方案1】:
I would instead add column to dataset for your "page_grouping_number" and populate it based on number of records in your dataset and only if the export option selected is Excel.
然后,将此列添加到您的报表数据源定义中,并按该列添加行组(启用分页选项)。这应该将每个页面推送到新的 Excel 文件表中。
关于分页的更多信息是here。
另外,question 与您的相似,答案可能包含一些有用的信息。
【解决方案2】:
在网上浏览了更多之后,发现 32 位 (x86) 应用程序仅使用最多 1.8 GB 的内存将为每个应用程序共享。在生成报告时,它会超出内存限制并导致内存不足异常。
尝试在 x64 中运行应用程序并生成报告,没有任何异常。