你好,我看了你的报表设计没有什么问题,就是一个简单的表格,设置了字体居中。
如下是我这是使用的导出的方法,你使用这个导出的方法试试
- / Provide the page report you want to render.
- GrapeCity.ActiveReports.PageReport report = new GrapeCity.ActiveReports.PageReport();
- GrapeCity.ActiveReports.Document.PageDocument reportDocument = new GrapeCity.ActiveReports.Document.PageDocument(report);
- // Create an output directory.
- System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyExcel");
- 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.Xls;
- 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, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
- // Overwrite output file if it already exists.
- outputProvider.OverwriteOutputFile = true;
- reportDocument.Render(excelRenderingExtension, outputProvider, setting.GetSettings());
复制代码
|