Free Support Forum -

Clarification about exporter functionality


I have a quick question about the different exporters in Aspose.Words for JasperReports: is there any difference in using one exporter instead of another if in the end I specify the SaveFormat?

Like, I do all the elaboration with AWDocExporter and then save as ODT, would it be different than directly using an AWOdtExporter?



I'm not really sure how you use SaveFormat in this situation. Could you please provide a sample code?


You’re right, I didn’t explain very well, I’m sorry.

The fact is that we use Aspose.Words for JasperReports in combination with Aspose.Words for Java to implement PDF document generation functionality: first we generate the document using the AWDocExporter, then we use the byte array generated to create a Document which we save to PDF. Here is a code sample

if(extension.equals(“DOC”) || extension.equals(“PDF”)){
exporterDOC = new AWDocExporter();
exporterDOC.setParameter(AWExporterParameter.EXPORT_LINES, true);
exporterDOC.setParameter(AWExporterParameter.PAGE_BREAKS, AWExporterParameter.PAGE_BREAKS_NORMAL);
exporterDOC.setParameter(AWExporterParameter.PAGE_MARGINS, “20px;20px;50px;10px”);
exporterDOC.setParameter(AWExporterParameter.RECOGNIZE_FIELDS, true);
output = exportReportToBytes(jasperPrint, exporterDOC, request);

Document tmp = new Document(new ByteArrayInputStream(output));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PdfOptions options = new PdfOptions();
tmp.saveToPdf(0, tmp.getPageCount(), baos, options);
output = baos.toByteArray();

I know it is quite “unhortodox”, but using this trick instead of native pdf exporter, we have the ability to export the document in PDF while maintain the Word fields correctly updated (for example, page number)

My question is, if we’d use this trick also for the DOCX and ODT format, would the document quality somehow “degrade” or would it be the same as using the dedicated exporter? This is more a curiosity than a real question, but I wanted to know if this procedure would affect document quality negatively.

Hi Matteo,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. Aspose.Words for JasperReports used Aspose.Words for Java internally to export in different formats. So I do not think you will lost quality of documents if you will export document such way.

Best regards.

Thanks for your clarifications.