Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyreportjasper/pyreportjasper.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def instantiate_report(self):
report.fill()
return report

def process_report(self):
def process_report(self, html_configurations=None):
error = None
base_input = os.path.splitext(self.config.input)
if base_input[-1] == ".jrxml":
Expand All @@ -139,7 +139,7 @@ def process_report(self):
try:
formats_functions = {
'pdf': report.export_pdf,
'html': report.export_html,
'html': lambda: report.export_html(html_configurations),
'rtf': report.export_rtf,
'docx': report.export_docx,
'odt': report.export_odt,
Expand Down
6 changes: 5 additions & 1 deletion pyreportjasper/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def __init__(self, config: Config, input_file):
self.SimpleXlsxReportConfiguration = jpype.JPackage('net').sf.jasperreports.export.SimpleXlsxReportConfiguration
self.JRCsvExporter = jpype.JPackage('net').sf.jasperreports.engine.export.JRCsvExporter
self.SimpleCsvExporterConfiguration = jpype.JPackage('net').sf.jasperreports.export.SimpleCsvExporterConfiguration
self.SimpleHtmlExporterConfiguration = jpype.JPackage('net').sf.jasperreports.export.SimpleHtmlExporterConfiguration
self.JRCsvMetadataExporter = jpype.JPackage('net').sf.jasperreports.engine.export.JRCsvMetadataExporter
self.SimpleCsvMetadataExporterConfiguration = jpype.JPackage('net').sf.jasperreports.export.SimpleCsvMetadataExporterConfiguration
self.JRSaver = jpype.JPackage('net').sf.jasperreports.engine.util.JRSaver
Expand Down Expand Up @@ -277,11 +278,14 @@ def export_pdf(self):
output_stream_pdf.flush() # if no buffer used, it can be ignored.
output_stream_pdf.close()

def export_html(self):
def export_html(self,html_configurations=None):
exporter = self.HtmlExporter()
exporter.setExporterInput(self.SimpleExporterInput(self.jasper_print))
output_stream = self.SimpleHtmlExporterOutput(self.get_output_stream(".html"))
exporter.setExporterOutput(output_stream)
configuration = self.SimpleHtmlExporterConfiguration()
configuration.setHtmlHeader(html_configurations)
exporter.setConfiguration(configuration)
exporter.exportReport()

def export_rtf(self):
Expand Down