We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Not able to generate doc that contains subreports

Hi
Can you please send me the sample example
for exporting jasper to doc that contains subreports and along with it
please send me the java files … Bcoz i’m not able to generate doc that
contains subreports …It would be really helpful.

Thanks
Avinash

Hi Avinash,

Thanks for your inquiry. You can use the AWDocExporter to export jrxml file to Doc file format. Please use the following code snippet for your kind reference. I have highlighted the code related to Aspose.Words for JasperReports. Hope this helps you. Please let us know if you have any more queries.

final JasperDesign jasperDesign = JRXmlLoader.load("c:\temp\Master.jrxml");
final JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("JASPER_SUBREPORT", "Subreport.jasper");
parameters.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, JRXmlUtils.parse("c:\\temp\\Test.xml"));
// Filling the report template with data
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters);
AWDocxExporter exporter = new AWDocxExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "c:\\temp\\out.docx");
exporter.exportReport();