图表生成器Stimulsoft Reports.Java示例:从代码导出报告

此示例项目展示了如何呈现报表并将其导出为各种格式。您可以使用超过 15 种格式进行导出,每种格式都可以设置。

此示例项目展示了如何呈现报表并将其导出为各种格式。您可以使用超过 15 种格式进行导出,每种格式都可以设置。

首先,加载报告并向其添加演示数据库。完成后,呈现报告:

...StiXmlDatabase xmlDatabase = new StiXmlDatabase("Demo", demoDir + "Demo.xsd", demoDir + "Demo.xml");StiReport renderReport = StiSerializeManager.deserializeReport(new File("Reports/SimpleList.mrt"));renderReport.getDictionary().getDatabases().add(xmlDatabase);renderReport.render();...

然后,根据格式,您可以使用默认导出设置导出报告:

...outputStream = new FileOutputStream(stiFileChooser.getFile());switch (format) {case Pdf:StiExportManager.exportPdf(report, outputStream);break;case Xps:StiExportManager.exportXps(report, outputStream);break;case Html:StiExportManager.exportHtml(report, outputStream);break;case Text:StiExportManager.exportText(report, outputStream);break;case Rtf:StiExportManager.exportRtf(report, outputStream);break;case Word2007:StiExportManager.exportWord2007(report, outputStream);break;case Excel:StiExportManager.exportExcel(report, outputStream);break;case ExcelXml:StiExportManager.exportExcelXml(report, outputStream);break;case Excel2007:StiExportManager.exportExcel2007(report, outputStream);break;case Csv:StiExportManager.exportCsv(report, outputStream);break;case Xml:StiExportManager.exportXml(report, outputStream);break;case Sylk:StiExportManager.exportSylk(report, outputStream);break;case ImageBmp:StiExportManager.exportImageBmp(report, outputStream);break;case ImageJpeg:StiExportManager.exportImageJpeg(report, outputStream);break;case ImagePcx:StiExportManager.exportImagePcx(report, outputStream);break;case ImagePng:StiExportManager.exportImagePng(report, outputStream);break;case ImageSvg:StiExportManager.exportImageSvg(report, outputStream);break;case ImageSvgz:StiExportManager.exportImageSvgz(report, outputStream);break;}...

您还可以自定义导出设置,例如导出为 PDF:

...StiPdfExportSettings pdfExportSettings = new StiPdfExportSettings();pdfExportSettings.setAllowEditable(StiPdfAllowEditable.Yes);pdfExportSettings.setPdfACompliance(true);pdfExportSettings.setEmbeddedFonts(true);pdfExportSettings.setPasswordInputUser("pass");StiExportManager.exportPdf(report, pdfExportSettings, outputStream);...

Aspose、E-iceblue、FastReport、Stimulsoft等文档/报表图表类开发工具享超低折扣,如有需要可直接联系在线客服。

标签:

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年7月23日
下一篇 2021年7月23日

相关推荐

发表回复

登录后才能评论