Package reportWriter
Class ReportFactory
java.lang.Object
reportWriter.ReportFactory
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 Summary
Modifier and TypeMethodDescriptionstatic boolean
convertReportToDocx
(Report report, String outputFilename) Converts a report to a docx document and saves to the drive.static boolean
convertReportToDocx
(Report report, String outputFilename, String templateFilename) Converts a report to a docx document and saves to the drivestatic Report
createReport
(String reportTitle) Create a report, using the passed String as the title.static boolean
openReportInWordProcessor
(String filename) Open file in whatever application the system associates with docx files.static BufferedImage
trimImage
(BufferedImage image) static BufferedImage
trimImage
(BufferedImage image, Color blankColour, Insets insets)
-
Method Details
-
createReport
Create a report, using the passed String as the title. Default Word template will be used- Parameters:
reportTitle
-- Returns:
-
convertReportToDocx
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 convertoutputFilename
- 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 convertoutputFilename
- The filename (including path) to save to. Note fileName should include the docx extensiontemplateFilename
- 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
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
-
trimImage
-