1.加载驱动
例如要连接oracle数据库需要导入oracle的驱动包将驱动包放入到报表的安装路径(E:soft_install_path_mainiReport-5.1.0
ireportcorelocale)给下面。
2.PDF字体无法显示
之前本人在ireport1.3中做饼状图的报表,但在饼状图中无法显示出中文,所以改换ireport5不会出现类似的问题,
本人觉得还是高版本的工具还是比较还用一些。
Error?exporting?print...?Could?not?load?the?following?font?:? pdfFontName???:?STSong-Light pdfEncoding???:?UniGB-UCS2-H
isPdfEmbedded?:?false
net.sf.jasperreports.engine.JRRuntimeException:?Could?not?load?the?following?font?:? pdfFontName???:?STSong-Light
pdfEncoding???:?UniGB-UCS2-H isPdfEmbedded?:?false? ????at?net.sf.jasperreports.engine.export.JRPdfExporter.getFont
(JRPdfExporter.java:2054)? ????at?net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:1817)? ????
at?net.sf.jasperreports.engine.export.JRPdfExporter.getPhrase(JRPdfExporter.java:1786)? ????at?
net.sf.jasperreports.engine.export.SimplePdfTextRenderer.getPhrase(SimplePdfTextRenderer.java:89)? ????at?
net.sf.jasperreports.engine.export.SimplePdfTextRenderer.render(SimplePdfTextRenderer.java:99)? ????at?
net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:2176)? ????at?
net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:860)? ????at?
net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:820)? ????at?
net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:697)? ????at?
net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:419)? ????at?
com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:1174)? ????at?
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)? ????at?
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)?
Export running time: 891!
Executing: rundll32 SHELL32.DLL,ShellExec_RunDLL "D:SSH2WebRoot
eports
eport1.pdf"
解决方法:
iTextAsian.jar 这个包导入项目的classpath中,没有这个包的话,导出含有中文数据的PDF会报以下错误:
net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font :
pdfFontName : STSong-Light
pdfEncoding : UniGB-UCS2-H(Chinese Siplified)
isPdfEmbedded : true