Return to Snippet

Revision: 28127
at July 1, 2010 17:41 by alejandrosuch


Initial Code
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.design.JasperDesign;
import net.sf.jasperreports.engine.xml.JRXmlLoader;
import net.sf.jasperreports.engine.xml.JRXmlWriter;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.engine.JasperReport;

class JasperToXml {
   public static String sourcePath, destinationPath, xml;
   public static JasperDesign jd  = new JasperDesign();   

   public static void main(String [] args) {
      // Paths
      sourcePath = "C:\Documents and Settings\user\My Documents\workspaces\jasper\File1.jasper";

      outputPath = "C:\Documents and Settings\user\My Documents\workspaces\jrxml\File2.jrxml";    

      try
      {
        // for converting a JasperReport object (compiled .jasper file) to a JasperDesign object
         jd  = JRXmlLoader.load(sourcePath);
         // is this the right way to do it???
      }
      catch(JRException e)
      {
         e.printStackTrace();
      }
      JRXmlWriter.writeReport(jd, outputPath); // 
   }
}

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

Initial Description

                                

Initial Title
Decompiling from .jasper to .jrxml

Initial Tags
java

Initial Language
Java