I lost all my .jrxml files, but I have .jasper files. Can I decompile .jasper files to .jrxml files? If yes, that would be a great help for me.
*.jasper files can be opened directly from ireport, Ireport decompile automatically the file.
win98
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.engine.xml.JRXmlWriter;
import net.sf.jasperreports.engine.JasperReport;
class JasperToXml {
public static String sourcePath;
public static String destinationPath;
public static void main(String[] args) {
sourcePath = "..File1.jasper";
destinationPath = "...File2.jrxml";
JasperReport report = (JasperReport) JRLoader.loadObject(sourcePath);
JRXmlWriter.writeReport(report, destinationPath, "UTF-8");
}
}
来源:https://stackoverflow.com/questions/7752140/how-to-decompile-jasper-files-into-jrxml-files