/** * Generates the XML representation of the report design loaded from the first file parameter * and place it in the file specified by the second parameter. The result is "UTF-8" encoded. * * @param sourceFileName source file name containing the report design object * @param destFileName output file name to write the XML report design representation to */ public static void writeReportToXmlFile( String sourceFileName, String destFileName ) throws JRException { JRReport report = (JRReport)JRLoader.loadObject(sourceFileName); writeReportToXmlFile( report, destFileName ); }
/** * Generates the XML representation of the report design loaded from the specified filename. * The result of this operation is an "UTF-8" encoded XML file having the same name as * the report design, plus the <code>*.jasper.jrxml</code> extension, located in the same directory as * the source file. * * @param sourceFileName source file name containing the report design object * @return XML representation of the report design */ public static String writeReportToXmlFile( String sourceFileName ) throws JRException { File sourceFile = new File(sourceFileName); /* We need the report name. */ JRReport report = (JRReport)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), report.getName() + ".jasper.jrxml"); String destFileName = destFile.toString(); writeReportToXmlFile( report, destFileName ); return destFileName; }