html方式导出word代码:
GrapeCity.ActiveReports.PageReport report = new GrapeCity.ActiveReports.PageReport(new FileInfo("RdlReport1.rdlx"));
GrapeCity.ActiveReports.Document.PageDocument reportDocument = new GrapeCity.ActiveReports.Document.PageDocument(report);
reportDocument.LocateDataSource += viewer1_LocateDataSource;
// Create an output directory.
System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo(@"C:\MyWord");
outputDirectory.Create();
// Provide settings for your rendering output.
GrapeCity.ActiveReports.Export.Word.Page.Settings wordSetting = new GrapeCity.ActiveReports.Export.Word.Page.Settings();
// Set the FileFormat property to .OOXML.
wordSetting.FileFormat = GrapeCity.ActiveReports.Export.Word.Page.FileFormat.HTML;
// Set the rendering extension and render the report.
GrapeCity.ActiveReports.Export.Word.Page.WordRenderingExtension wordRenderingExtension = new GrapeCity.ActiveReports.Export.Word.Page.WordRenderingExtension();
GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory,
System.IO.Path.GetFileNameWithoutExtension("TestReport"));
// Overwrite output file if it already exists.
outputProvider.OverwriteOutputFile = true;
reportDocument.Render(wordRenderingExtension, outputProvider, wordSetting);
|