Uploaded image for project: 'ZK Spreadsheet'
  1. ZK Spreadsheet
  2. ZSS-826

Fail to export to PDF if set chart title font

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 3.7.0
    • 3.6.0
    • None
    • None

      Steps to Reproduce

      1. put the library property below in zk.xml
        	<library-property>
        		<name>org.zkoss.zss.chart.title.font</name>
        		<value>sansserif, bold, 30</value>
        	</library-property>
        
      2. run zssapp
      3. load demo_sample.xlsx
      4. export to pdf

      Actual Result

      Exception thrown in 3.6

      ExceptionConverter: java.io.IOException: The document has no pages.
           at com.lowagie.text.pdf.PdfPages.writePageTree(Unknown Source)
           at com.lowagie.text.pdf.PdfWriter.close(Unknown Source)
           at com.lowagie.text.pdf.PdfDocument.close(Unknown Source)
           at com.lowagie.text.Document.close(Unknown Source)
           at org.zkoss.zss.model.impl.pdf.PdfExporter.export(PdfExporter.java:263 )
           at org.zkoss.zss.api.impl.ExporterImpl.export(ExporterImpl.java:49 )
           at org.zkoss.zss.essential.ExportPdfComposer.doExport(ExportPdfComposer.java:41)
           at sun.reflect.NativeMethodAccessorImpl.invoke0( Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39 )
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25 )
           at java.lang.reflect.Method.invoke( Method.java:597)
           at org.zkoss.zk.ui.select.Selectors$ComposerEventListener.onEvent(Selectors.java:681)
           at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2752 )
           at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2723 )
           at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2664 )
           at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136 )
           at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1765 )
           at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1550 )
           at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1260 )
           at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:603 )
           at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:485 )
           at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494 )
      
      

      Exception thrown in 3.5

      java.lang.NullPointerException
      	at org.zkoss.zssex.util.ZssChartExportEngine.drawJFreeChart(ZssChartExportEngine.java:99)
      	at org.zkoss.zssex.util.ChartHelper.drawJFreeChart(ChartHelper.java:78)
      	at org.zkoss.zss.model.impl.pdf.PdfExporter.layoutCharts(PdfExporter.java:999)
      	at org.zkoss.zss.model.impl.pdf.PdfExporter.access$1500(PdfExporter.java:86)
      	at org.zkoss.zss.model.impl.pdf.PdfExporter$PdfHeaderFooter.onEndPage(PdfExporter.java:1613)
      	at com.lowagie.text.pdf.PdfDocument.newPage(Unknown Source)
      	at com.lowagie.text.Document.newPage(Unknown Source)
      	at org.zkoss.zss.model.impl.pdf.PdfExporter.printColumns(PdfExporter.java:581)
      	at org.zkoss.zss.model.impl.pdf.PdfExporter.exportSheet(PdfExporter.java:302)
      	at org.zkoss.zss.model.impl.pdf.PdfExporter.export(PdfExporter.java:182)
      	at org.zkoss.zss.api.impl.ExporterImpl.export(ExporterImpl.java:49)
      	at org.zkoss.zss.essential.ExportPdfComposer.doExport(ExportPdfComposer.java:57)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.zkoss.zk.ui.select.Selectors$ComposerEventListener.onEvent(Selectors.java:681)
      	at org.zkoss.zk.ui.AbstractComponent.onEvent(AbstractComponent.java:2746)
      	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2717)
      	at org.zkoss.zk.ui.AbstractComponent.service(AbstractComponent.java:2658)
      	at org.zkoss.zk.ui.impl.EventProcessor.process(EventProcessor.java:136)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.processEvent(UiEngineImpl.java:1765)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.process(UiEngineImpl.java:1550)
      	at org.zkoss.zk.ui.impl.UiEngineImpl.execUpdate(UiEngineImpl.java:1260)
      	at org.zkoss.zk.au.http.DHtmlUpdateServlet.process(DHtmlUpdateServlet.java:603)
      	at org.zkoss.zk.au.http.DHtmlUpdateServlet.doGet(DHtmlUpdateServlet.java:485)
      	at org.zkoss.zk.au.http.DHtmlUpdateServlet.doPost(DHtmlUpdateServlet.java:494)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
      	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
      	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
      	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
      	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
      	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
      	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
      	at org.mortbay.jetty.Server.handle(Server.java:326)
      	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
      	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
      	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
      	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
      	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
      	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
      	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
      

      Debug Information

      From exception thrown in 3.5, I think root cause is in ZssChartExportEngine

                              final Font tfont = ChartHelper.getCustomFont(ChartHelper.TITLE_FONT_PROPERTY_KEY);
      			if (tfont != null) {
      				jfchart.getTitle().setFont(tfont);
      			}
      

      because chart title might be null.

            henrichen henrichen
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: