Free Support Forum - aspose.com

Help to setup and evaluate the word aspose to Jasper reports product

Hi I need Help to setup and evaluate the word aspose to Jasper reports product.

Hi Latchoumi,


Thanks for your interest in Aspose. Please check here for configuration setting of Aspose.Words for JasperReports and documentation details.

For evaluation you can also request a free temporary license. Moreover, I’m moving your query to the related forum, Aspose.Words, as well.

Please feel free to contact us for any further assistance.

Best Regards,

Hi Tilal,

Thanks for your response. I am trying to use Aspose word for existing Jasper reports in my project. We pass in some data object at runtime to generate the reports using that dynamic data. Can you give me some examples that will help my senario? I am pasting below the java code that I tried so far. And I am also pasting the error that I got.

AWDocExporter exporter = new AWDocExporter();
File sourceFile = templateLocation.getFile();
JasperReport jasperReport = (JasperReport) JRLoader.loadObject(sourceFile);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, model);
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".doc");
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
exporter.exportReport();

And I got this error,

java.lang.NoSuchMethodError: net.sf.jasperreports.engine.JROrigin.getBandType()B
at com.aspose.words.jasperreports.b.c.a(Unknown Source)
at com.aspose.words.jasperreports.c.g.sK(Unknown Source)
at com.aspose.words.jasperreports.a.a.i.b(Unknown Source)
at com.aspose.words.jasperreports.a.a.f.a(Unknown Source)
at com.aspose.words.jasperreports.a.a.f.a(Unknown Source)
at com.aspose.words.jasperreports.AWAbstractExporter.b(Unknown Source)
at com.aspose.words.jasperreports.AWAbstractExporter.exportReport(Unknown Source)

Thanks,

Latchoumi

Hi Latchoumi,


Please note that latest version of Aspose.Words for JasperReports 1.7.0 contains two jar files:

  1. aspose.words.jasperreports.jar
  2. aspose.words.jasperreports-3.7.1.jar

You should use only one of them. When you are using JasperReports version greater than 3.7.1 (this is your case), please use only aspose.words.jasperreports.jar file. The aspose.words.jasperreports-3.7.1.jar is for JasperReports v.3.7.1 and lower versions.

Please check the following two examples for your kind reference. First example uses XML as data source and second example uses empty data source. Please let me know, If you have any more queries.

<span lang=“EN-GB” style=“font-size:10.0pt;font-family:“Courier New”;color:green;mso-font-kerning:
0pt;mso-no-proof:yes”>//use xml data srouce<o:p></o:p>

final JasperDesign jasperDesign = JRXmlLoader.load("C:\\in.jrxml");

final JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);

final String output = "C:\\AsposeOut.docx";

JRXmlDataSource jrxmlds = new JRXmlDataSource("C:\\data.xml", "/objects/data");

// Filling the report template with data

JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(),jrxmlds);

AWDocxExporter exporter = new AWDocxExporter();

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(AWExporterParameter.USE_EXACT_ROW_HEIGHTS, true);

exporter.setParameter(AWExporterParameter.RECOGNIZE_FIELDS, true);

exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, output);

exporter.exportReport();

//use empty data srouce

final JasperDesign jasperDesign = JRXmlLoader.load("C:\\in.jrxml");

final JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);

final JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(),new JREmptyDataSource());

final String dest2 = new String("C:\\AsposeOut.doc");

AWDocExporter docExporter = new AWDocExporter();

docExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

docExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, dest2);

docExporter.exportReport();



Hi

Thanks for the information and it worked. But the reason I wanted to try and use your product is to solve a frame component issue when using the JRDocxExporter from the Jasper library. We were using the Frame component from the jasper designer to make some of the fields to expand together as per the size of the data dynamically. When used with the docx exporter it was throwing of the borders and spoiling the look of the tables in the report. Also one other issue was, it was not displaying a background text in the reports. When I tried your product I still see the Frame issue. Do you guys have a solution for these issues?

Hi Latchoumi,


Thanks for your inquiry. Could you please attach your JRXML files along with data source here for testing? I will investigate the issue on my side and provide you more information.