Skip to content

Commit

Permalink
Stop RTF
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Oct 2, 2024
1 parent 40d68b8 commit b3fe471
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.export.HtmlExporter;
import net.sf.jasperreports.engine.export.JRCsvExporter;
import net.sf.jasperreports.engine.export.JRRtfExporter;
import net.sf.jasperreports.engine.export.JRXmlExporter;
import net.sf.jasperreports.engine.fill.JRFiller;
import net.sf.jasperreports.engine.fill.SimpleJasperReportSource;
Expand Down Expand Up @@ -156,21 +155,21 @@ public byte[] html() throws JRException {
return outputStream.toByteArray();
}

@POST
@Path("rtf")
public byte[] rtf() throws JRException {
long start = System.currentTimeMillis();
JasperPrint jasperPrint = fill();

JRRtfExporter exporter = new JRRtfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
exporter.setExporterOutput(new SimpleWriterExporterOutput(outputStream));

exporter.exportReport();
Log.info("RTF creation time : " + (System.currentTimeMillis() - start));
return outputStream.toByteArray();
}
// @POST
// @Path("rtf")
// public byte[] rtf() throws JRException {
// long start = System.currentTimeMillis();
// JasperPrint jasperPrint = fill();
//
// JRRtfExporter exporter = new JRRtfExporter();
// exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
// ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
// exporter.setExporterOutput(new SimpleWriterExporterOutput(outputStream));
//
// exporter.exportReport();
// Log.info("RTF creation time : " + (System.currentTimeMillis() - start));
// return outputStream.toByteArray();
// }

// @POST
// @Path("print")
Expand Down Expand Up @@ -326,4 +325,4 @@ public byte[] rtf() throws JRException {
//
// return outputStream.toByteArray();
// }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ void testExportHTML() {
.statusCode(200);
}

@Test
void testExportRTF() {
given()
.when().post("/jasperreports/rtf")
.then()
.statusCode(200);
}
// @Test
// void testExportRTF() {
// given()
// .when().post("/jasperreports/rtf")
// .then()
// .statusCode(200);
// }

// @Test
// void testExportPDF() {
Expand Down Expand Up @@ -109,4 +109,4 @@ void testExportRTF() {
// .then()
// .statusCode(200);
// }
}
}

0 comments on commit b3fe471

Please sign in to comment.