- // Provide the page report you want to render.
- GrapeCity.ActiveReports.PageReport report = new GrapeCity.ActiveReports.PageReport(new FileInfo(@".\Invoice.rdlx"));
- GrapeCity.ActiveReports.Document.PageDocument reportDocument = new GrapeCity.ActiveReports.Document.PageDocument(report);
- // Create an output directory.
- DirectoryInfo outputDirectory = new DirectoryInfo(@".");
- outputDirectory.Create();
- // Provide settings for your rendering output.
- GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings excelSetting =
- new GrapeCity.ActiveReports.Export.Excel.Page.ExcelRenderingExtensionSettings();
- excelSetting.FileFormat = GrapeCity.ActiveReports.Export.Excel.Page.FileFormat.Xlsx;
- excelSetting.Pagination = false;
- excelSetting.MultiSheet = 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.GetFileNameWithoutExtension(outputDirectory.Name));
- // Overwrite output file if it already exists.
- outputProvider.OverwriteOutputFile = true;
- reportDocument.Render(excelRenderingExtension, outputProvider, setting.GetSettings());
复制代码 关键就是下面这一行不起作用;而且在设计界面 Preview 的时候,直接导出,也没有那个 Pagination 属性的选项。
- excelSetting.Pagination = false;
复制代码 测试工程在附件里,.Net Core 的工程,打开安装一下 NuGet 依赖,然后运行,会在下面目录生成 Excel:
....\ReportsDemo\ReportsDemo\bin\Debug\netcoreapp3.1\netcoreapp3.xlsx
我这 ActiveReports 的版本是 14.1.19937.0 ,Professional 版本,已激活。
|