Class StraightToEverything


  • public class StraightToEverything
    extends Object
    A demonstration that shows how to generate a report and save it to PDF without displaying the print preview or the PDF save-as dialog. The methods to save the report to the various file formats are also implemented in
    Author:
    Thomas Morgner
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void createCSV​(org.pentaho.reporting.engine.classic.core.MasterReport report, String filename)
      Saves a report to CSV format.
      static void createDirectoryHTML​(org.pentaho.reporting.engine.classic.core.MasterReport report, String filename)
      Saves a report to HTML.
      static boolean createPDF​(org.pentaho.reporting.engine.classic.core.MasterReport report, String fileName)
      Saves a report to PDF format.
      static void createPlainText​(org.pentaho.reporting.engine.classic.core.MasterReport report, String filename)
      Saves a report to plain text format.
      static void createRTF​(org.pentaho.reporting.engine.classic.core.MasterReport report, String filename)
      Saves a report to rich-text format (RTF).
      static void createStreamHTML​(org.pentaho.reporting.engine.classic.core.MasterReport report, String filename)
      Saves a report into a single HTML format.
      static void createXLS​(org.pentaho.reporting.engine.classic.core.MasterReport report, String filename)
      Saves a report to Excel format.
      static void createZIPHTML​(org.pentaho.reporting.engine.classic.core.MasterReport report, String filename)
      Saves a report in a ZIP file.
      static void main​(String[] args)
      Demo starting point.
    • Constructor Detail

      • StraightToEverything

        public StraightToEverything​(String filename)
                             throws org.pentaho.reporting.libraries.xmlns.parser.ParseException
        Creates a new demo application.
        Parameters:
        filename - the output filename.
        Throws:
        org.pentaho.reporting.libraries.xmlns.parser.ParseException - if the report could not be parsed.
    • Method Detail

      • createPDF

        public static boolean createPDF​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                        String fileName)
        Saves a report to PDF format.
        Parameters:
        report - the report.
        fileName - target file name.
        Returns:
        true or false.
      • createPlainText

        public static void createPlainText​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                           String filename)
                                    throws Exception
        Saves a report to plain text format.
        Parameters:
        report - the report.
        filename - target file name.
        Throws:
        Exception - if an error occurs.
      • createRTF

        public static void createRTF​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                     String filename)
                              throws Exception
        Saves a report to rich-text format (RTF).
        Parameters:
        report - the report.
        filename - target file name.
        Throws:
        Exception - if an error occurs.
      • createCSV

        public static void createCSV​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                     String filename)
                              throws Exception
        Saves a report to CSV format.
        Parameters:
        report - the report.
        filename - target file name.
        Throws:
        Exception - if an error occurs.
      • createXLS

        public static void createXLS​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                     String filename)
                              throws Exception
        Saves a report to Excel format.
        Parameters:
        report - the report.
        filename - target file name.
        Throws:
        Exception - if an error occurs.
      • createStreamHTML

        public static void createStreamHTML​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                            String filename)
                                     throws Exception
        Saves a report into a single HTML format.
        Parameters:
        report - the report.
        filename - target file name.
        Throws:
        Exception - if an error occurs.
      • createDirectoryHTML

        public static void createDirectoryHTML​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                               String filename)
                                        throws Exception
        Saves a report to HTML. The HTML file is stored in a directory.
        Parameters:
        report - the report.
        filename - target file name.
        Throws:
        Exception - if an error occurs.
      • createZIPHTML

        public static void createZIPHTML​(org.pentaho.reporting.engine.classic.core.MasterReport report,
                                         String filename)
                                  throws Exception
        Saves a report in a ZIP file. The zip file contains a HTML document.
        Parameters:
        report - the report.
        filename - target file name.
        Throws:
        Exception - if an error occurs.
      • main

        public static void main​(String[] args)
        Demo starting point.
        Parameters:
        args - ignored.