Hitachi Vantara Pentaho Community Forums
Results 1 to 2 of 2

Thread: Export table to pdf document

  1. #1
    Join Date
    Apr 2008
    Posts
    7

    Default Export table to pdf document

    Hello!
    I use jfreereport 9.3. I’d like to change table style when publish my resultSet to pdf document. By default table in pdf document has no borders.
    I tried
    HTML Code:
    <table style="" >
    but it is not work properly. Now I use
    HTML Code:
    <td style="border-style: double; border-color: blue">
    but my table looks not very pretty.


    Code:
    final Resource res = manager.createDirectly(url, JFreeReport.class);
     final JFreeReport resource = (JFreeReport) res.getResource();
     Class.forName("org.gjt.mm.mysql.Driver").newInstance();
     Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test", "root","");
     ResultSet rs = conn.createStatement().executeQuery("SELECT name, age FROM test_proc1");
     CloseableTableModel model = ResultSetTableModelFactory.getInstance().createTableModel(rs);
     final DefaultReportJob job = new DefaultReportJob(resource);
      final TableReportDataFactory dataFactory = new TableReportDataFactory("default", model);
      job.setDataFactory(dataFactory);
     
     <report:detail-section> 
     <table style="" >
       <col style="width: 50%"/>
       <col style="width: 50%"/>
       <tbody>
        <tr><td style="border-style: double; border-color: blue">
         <report:content>
             <report:value-expression formula="jfreereport:[age]"/>
          </report:content> 
          </td><td style="border-style: double ; border-color: blue">
             <report:content>
               <report:value-expression formula="jfreereport:[name]"/>
             </report:content>         
          </td></tr>
         </tbody>
     </table>
     </report:detail-section>
     
    
    The second question is about autotable. How I can add more than one column to my auto-table and use styles?
    Code:
    <autotable:auto-table style="width:100%">
     <autotable:auto-table-header>
       <autotable:auto-table-content item="name"/>
     </autotable:auto-table-header>
     <autotable:auto-table-cell>
       <autotable:auto-table-content item="value"/>
     </autotable:auto-table-cell>
    </autotable:auto-table>
    
    Last edited by void_v; 05-08-2008 at 07:38 AM.

  2. #2
    Join Date
    Apr 2008
    Posts
    7

    Default Cannot set border to table

    When i try to use border attribute in style statement i get exception.

    Code:
        <report:detail-section> 
        <table style="border-style: solid;" >
          <col style="width: 33%"/>
          <col style="width: 33%"/>
          <col style="width: 33%"/>      
          <tbody>
           <tr style=""><td style="">
            <report:content>
                <report:value-expression formula="jfreereport:[age]"/>
             </report:content> 
             </td>
             <td style="">
                <report:content>
                  <report:value-expression formula="jfreereport:[name]"/>
                </report:content>         
             </td>
            <td style="">
                <report:content format="MM-dd-yyyy HH:mm">
                  <report:value-expression formula="jfreereport:[date]"/>
                </report:content>         
             </td>
            </tr>
            </tbody>
        </table>
        </report:detail-section>
    java.lang.IllegalStateException: Shift-back is not allowed.
    at org.jfree.layouting.renderer.process.TableRowHeightStep.finishSection(TableRowHeightStep.java:256)
    at org.jfree.layouting.renderer.process.TableRowHeightStep.finishBlockLevelBox(TableRowHeightStep.java:191)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:169)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:59)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.processBoxChilds(IterateVisualProcessStep.java:193)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:167)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:59)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.processBoxChilds(IterateVisualProcessStep.java:193)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:167)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:59)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.processBoxChilds(IterateVisualProcessStep.java:193)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:167)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:59)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.processBoxChilds(IterateVisualProcessStep.java:193)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.processFlow(IterateVisualProcessStep.java:181)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:151)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:59)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.processBoxChilds(IterateVisualProcessStep.java:193)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.processBlockLevelChild(IterateVisualProcessStep.java:137)
    at org.jfree.layouting.renderer.process.IterateVisualProcessStep.startProcessing(IterateVisualProcessStep.java:59)
    at org.jfree.layouting.renderer.process.TableRowHeightStep.compute(TableRowHeightStep.java:128)
    at org.jfree.layouting.renderer.PaginatingRenderer.validateOutput(PaginatingRenderer.java:219)
    at org.jfree.layouting.renderer.AbstractRenderer.tryValidateOutput(AbstractRenderer.java:301)
    at org.jfree.layouting.renderer.AbstractRenderer.finishedTableRow(AbstractRenderer.java:925)
    at org.jfree.layouting.normalizer.generator.DefaultContentGenerator.finishedTableRow(DefaultContentGenerator.java:226)
    at org.jfree.layouting.normalizer.displaymodel.FastDisplayModelBuilder.callFinish(FastDisplayModelBuilder.java:817)
    at org.jfree.layouting.normalizer.displaymodel.FastDisplayModelBuilder.endElement(FastDisplayModelBuilder.java:751)
    at org.jfree.layouting.normalizer.content.ContentNormalizer.endElement(ContentNormalizer.java:950)
    at org.jfree.layouting.layouter.feed.DefaultInputFeed.performEndElement(DefaultInputFeed.java:562)
    at org.jfree.layouting.layouter.feed.DefaultInputFeed.endElement(DefaultInputFeed.java:544)
    at org.jfree.report.flow.LibLayoutReportTarget.endElement(LibLayoutReportTarget.java:309)
    at org.jfree.report.flow.layoutprocessor.ElementLayoutController.handleDefaultEndElement(ElementLayoutController.java:376)
    DEBUG: org.jfree.layouting.renderer.model.page.LogicalPageBox[1754699]={x=0, y=0, width=481616, height=210751}

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.