报表上的数据条数显示的是正确的,但是导出到Excel后,发现少了一条数据。导出Excel的代码如下:
- // Provide settings for your rendering output.
- GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings excelSetting = new GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings();
- excelSetting.FileFormat = Path.GetExtension(filePath)?.ToLower() == ".xls" ? GrapeCity.ActiveReports.Export.Excel.Page.FileFormat.Xls : GrapeCity.ActiveReports.Export.Excel.Page.FileFormat.Xlsx;
- excelSetting.MultiSheet = false;
- excelSetting.Pagination = false;
- GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = excelSetting;
- // Set the rendering extension and render the report.
- GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension excelRenderingExtension = new GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtension();
- GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, Path.GetFileName(filePath));
- // Overwrite output file if it already exists.
- outputProvider.OverwriteOutputFile = true;
- document.Render(excelRenderingExtension, outputProvider, setting.GetSettings());
复制代码 缺少数据效果如下:
在线求助!
|