tanguy.yves Posted December 1, 2016 Share Posted December 1, 2016 Hello,I am running iReport 5.6.0 and a very simple report (one title and 1 line in band detail). Compilation as well as preview is running well.Now I try to do the same with Eclipse Oxygen (JRE 1.7) and I am facing the two following issues :1 - no jasper file produced2- my final report (pdf or html) doesn't contain the expected content (simple title and band detail), seem to be emptyMy java code is hereafter : import java.io.FileInputStream;import java.io.InputStream;import java.util.HashMap;import net.sf.jasperreports.engine.JasperCompileManager;import net.sf.jasperreports.engine.JasperExportManager;import net.sf.jasperreports.engine.JasperFillManager;import net.sf.jasperreports.engine.JasperPrint;import net.sf.jasperreports.engine.JasperReport;import net.sf.jasperreports.engine.data.JRMapArrayDataSource;import net.sf.jasperreports.engine.design.JasperDesign;import net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter;import net.sf.jasperreports.engine.xml.JRXmlLoader;import net.sf.jasperreports.export.SimpleExporterInput;import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput;import net.sf.jasperreports.export.SimpleXlsxReportConfiguration;public class Main { public static void main(String[] args) { try { // I don't use data for my simple report so I think null for dataSource is not blocking point JRMapArrayDataSource dataSource = new JRMapArrayDataSource(null); HashMap<String,Object> params = new HashMap<String,Object>(); String inputsDirectory = "C:\Users\ytanguy\ireport\inputs\"; String outputsDirectory = "C:\Users\ytanguy\ireport\outputs\"; String XMLfile = "test.jrxml" ; String PDFfile = "test.pdf" ; String HTMLfile = "test.html" ; JasperDesign jasperDesign = JRXmlLoader.load (new FileInputStream(new File( inputsDirectory + XMLfile))); JasperReport jasperReport = JasperCompileManager.compileReport( jasperDesign ); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, dataSource); //Write the report to PDF file JasperExportManager.exportReportToPdfFile(jasperPrint, outputsDirectory + PDFfile); //Write the report to HTML file JasperExportManager.exportReportToHtmlFile(jasperPrint, outputsDirectory + HTMLfile); } catch (Exception e) { System.out.println( "Oups une exception ! "); e.printStackTrace(); } System.out.println("Fin"); }//public static void main}//public class Thanks in advance for your suggestion.Best regards 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