您好,
我们测试了导出,没有发现您所描述的问题。您可以参考下导出的代码,看是否能够解决问题。
如果没有,请上传能够重现问题的例子程序,我们可以帮您调式。
1.web显示
2.导出结果
导出代码
- protected void Button6_Click(object sender, EventArgs e)
- {
- // Provide the page report you want to render.
- GrapeCity.ActiveReports.PageReport _reportDef = new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(Server.MapPath("/Reports/" + report + ".rdlx")));
- //_reportDef.Report.DataSources[0].DataSourceReference = "";
- //_reportDef.Report.DataSources[0].ConnectionProperties.DataProvider = "OLEDB";
- //_reportDef.Report.DataSources[0].ConnectionProperties.ConnectString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};", Server.MapPath("/Data/NWind_CHS.mdb"));
- GrapeCity.ActiveReports.Document.PageDocument _reportRuntime = new GrapeCity.ActiveReports.Document.PageDocument(_reportDef);
- // Create an output directory
- System.IO.MemoryStream ms = new System.IO.MemoryStream();
- // 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.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.MemoryStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.MemoryStreamProvider();
- _reportRuntime.Render(excelRenderingExtension, outputProvider, excelSetting.GetSettings());
- Response.ContentType = "application/vnd.ms-excel";
- Response.AddHeader("content-disposition", "inline;filename=MyExport.xlsx");
- outputProvider.GetPrimaryStream().OpenStream().CopyTo(ms);
- Response.BinaryWrite(ms.ToArray());
- Response.End();
- }
复制代码 |