Decompiling from .jasper to .jrxml


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. import net.sf.jasperreports.engine.JRException;
  2. import net.sf.jasperreports.engine.design.JasperDesign;
  3. import net.sf.jasperreports.engine.xml.JRXmlLoader;
  4. import net.sf.jasperreports.engine.xml.JRXmlWriter;
  5. import net.sf.jasperreports.engine.util.JRLoader;
  6. import net.sf.jasperreports.engine.JasperReport;
  7.  
  8. class JasperToXml {
  9. public static String sourcePath, destinationPath, xml;
  10. public static JasperDesign jd = new JasperDesign();
  11.  
  12. public static void main(String [] args) {
  13. // Paths
  14. sourcePath = "C:\Documents and Settings\user\My Documents\workspaces\jasper\File1.jasper";
  15.  
  16. outputPath = "C:\Documents and Settings\user\My Documents\workspaces\jrxml\File2.jrxml";
  17.  
  18. try
  19. {
  20. // for converting a JasperReport object (compiled .jasper file) to a JasperDesign object
  21. jd = JRXmlLoader.load(sourcePath);
  22. // is this the right way to do it???
  23. }
  24. catch(JRException e)
  25. {
  26. e.printStackTrace();
  27. }
  28. JRXmlWriter.writeReport(jd, outputPath); //
  29. }
  30. }

URL: http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=25854

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.