maulik_nanavaty Posted March 30, 2017 Share Posted March 30, 2017 I have a simple Jasper Report created using Jaspersoft Studio 6.3.1 and I have couple of rectangle element with backcolor in it and also couple of line elements.Now from my Java code, I am trying to generate report in different formats using JasperPrint and trying to generate PDF and MS Word (.docx) version of this report by passing datasource from there. This code runs successfully and generates PDF and docx versions, but those rectangle and line elements with backcolor are only visible in PDF version and not in MS Word version. Is that a normal behavior or it is possible to get all that formatting in Word version as well? If yes, then can you please share code snippet to do that? I'm using following code to generate PDF and Word versions. JasperPrint jasperPrint = JasperFillManager.fillReport(reportName, params, vnDataSource.create(jasperReport)); // exporting process // 1- export to PDF JasperExportManager.exportReportToPdfFile(jasperPrint, fileName + ".pdf"); // 2- export to Word JRDocxExporter exporter = new JRDocxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); File exportReportFile = new File(fileName + ".docx"); exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(exportReportFile)); exporter.exportReport(); Any help is much appreciated!! Link to comment Share on other sites More sharing options...
hozawa Posted March 31, 2017 Share Posted March 31, 2017 It's a normal behavior with JasperReports for all Office document type exports.You'll need to customize the exporter to make it work like I did with xls exporter.http://community.jaspersoft.com/questions/968571/xls-export-missing-overlapping-shapes Link to comment Share on other sites More sharing options...
maulik_nanavaty Posted March 31, 2017 Author Share Posted March 31, 2017 Thanks for your answer, but sorry I didn't get that. How did you fix the xls issue? Basically is there any specific code which goes on Java side when we export and print the report in MS Word or fix is really in the .jrxml file at the design time? Link to comment Share on other sites More sharing options...
maulik_nanavaty Posted March 31, 2017 Author Share Posted March 31, 2017 Thanks for your answer, but sorry I didn't get that. How did you fix the xls issue? Basically is there any specific code which goes on Java side when we export and print the report in MS Word or fix is really in the .jrxml file at the design time? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now