Package reportWriter

Class ReportFactory

java.lang.Object
reportWriter.ReportFactory

public final class ReportFactory extends Object
Static class containing all of the processing necessary to generate a docx report from a Report object. This is basically the interface between PAMGuard and docx4j. See the ReportWriterTest class for an example of how to create a report
Author:
mo55
  • Method Details

    • createReport

      public static Report createReport(String reportTitle)
      Create a report, using the passed String as the title. Default Word template will be used
      Parameters:
      reportTitle -
      Returns:
    • convertReportToDocx

      public static boolean convertReportToDocx(Report report, String outputFilename)
      Converts a report to a docx document and saves to the drive. This uses the default docx4j template and styles
      Parameters:
      report - The report to convert
      outputFilename - The filename (including path) to save to. Note fileName should include the docx extension
      Returns:
      true if successful, false otherwise
    • convertReportToDocx

      public static boolean convertReportToDocx(Report report, String outputFilename, String templateFilename)
      Converts a report to a docx document and saves to the drive
      Parameters:
      report - The report to convert
      outputFilename - The filename (including path) to save to. Note fileName should include the docx extension
      templateFilename - The filename (including path) to use as a template. Can be null, to use the default. Note that a template file can be used to set up the different Styles
      Returns:
      true if successful, false otherwise
    • openReportInWordProcessor

      public static boolean openReportInWordProcessor(String filename)
      Open file in whatever application the system associates with docx files.
      Parameters:
      filename - the filename, including path, of the file to open.
      Returns:
      true is successful, false otherwise
    • trimImage

      public static BufferedImage trimImage(BufferedImage image)
    • trimImage

      public static BufferedImage trimImage(BufferedImage image, Color blankColour, Insets insets)