问题
Out of memory exception thrown - I tried to export a large record from report viewer into excel in windows forms. I have applied grouping for page breaks since excel does not allow above 65535 rows. Below expression is used for Group On expression,
=Int((RowNumber(Nothing))/10000)
Page Break at end Checkbox is enabled for this grouping
while exporting by clicking on the default export option available in report viewer control. But results in out of memory exception thrown.
Am i doing right? is there any solution or work around for this?
Thanks in advance,
回答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.
Then, add this column to your report data source definition and add row group by that column (with page break option enabled). This should push each page into new sheet of Excel file.
More information on pagination is here.
Also, this question is similar to yours and answers may have some useful info.
回答2:
After more surfing on the net, found that 32 bit(x86) application uses only maximum of 1.8 GB of memory will be shared for each application. while generating report it crosses the memory limit and leads to out of memory exception.
Tried to run the application in x64 and report is generated without any exceptions.
来源:https://stackoverflow.com/questions/45548874/report-viewer-throws-out-of-memory-exception-error-while-exporting-to-excel