Crystal reports export to excel cell merge issue

£可爱£侵袭症+ 提交于 2019-12-18 09:06:02

问题


When I export from Crystal Reports, any fields that are marked as Can Grow are merged with an otherwise blank row below them.

This completely messes up my sorting. How can I resolve this?


回答1:


I suggest another way: choose ExportFormatType.ExcelRecord instead of ExportFormatType.Excel. The xls file will be created without formatting.

If actually the user is exporting report using ReportViewer Toolbar Export button you can:

  • Replace the CrystalReportViewer Control with the ReportExporter Control. It will export the report in the format you choose.

Or hide Export button from toolbar and put in the page buttons that exports programmatically

  • Call ExportToHttpResponse method

CrystalReportSource1.ReportDocument.ExportToHttpResponse(ExportFormatType.ExcelRecord, this.Response , false, "report.xls");

  • Call ExportToDisk method

reportDocument.ExportToDisk(ExportFormatType.ExcelRecord, "report.xls");

  • Export dataset to excel (Look at Ahmed answer)

You can choose the way that best fits your needs, but you must try if it works with the runtime you use either in development or in release server.

ExportFormatType.ExcelRecord means that is generated an xls file, without formatting. If you set ExportFormatType.Excel fields that are marked as "Can Grow" are merged with an otherwise blank row below them.




回答2:


I always get a lot of problems while exporting crystal report to excel, I always got the same problem you have encountered.
I solved that problem by exporting dataset (report datasource) directly to excel, this solved all the issues, I've encountered.

Please refer to this link for Export a Dataset to Excel.



来源:https://stackoverflow.com/questions/3153199/crystal-reports-export-to-excel-cell-merge-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!