Java Code Examples for net.sf.jasperreports.engine.util.JRLoader#loadObject()

The following examples show how to use net.sf.jasperreports.engine.util.JRLoader#loadObject() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MapApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void xlsx() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/MapReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx");
	
	JRXlsxExporter exporter = new JRXlsxExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
	SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
	configuration.setOnePagePerSheet(true);
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start));
}
 
Example 2
Source File: XlsFormulaApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void xls() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/XlsFormulaReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xls");
	
	JRXlsExporter exporter = new JRXlsExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
	SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
	configuration.setOnePagePerSheet(false);
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("XLS creation time : " + (System.currentTimeMillis() - start));
}
 
Example 3
Source File: BookApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void xlsx() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/BookReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx");
	
	JRXlsxExporter exporter = new JRXlsxExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
	SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
	configuration.setOnePagePerSheet(false);
	exporter.setConfiguration(configuration);

	exporter.exportReport();

	System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start));
}
 
Example 4
Source File: MondrianApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void xls() throws JRException
{
	File[] files = getFiles(new File("build/reports"), "jrprint");
	for(int i = 0; i < files.length; i++)
	{
		long start = System.currentTimeMillis();
		File sourceFile = files[i];

		JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

		File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xls");
	
		JRXlsExporter exporter = new JRXlsExporter();
	
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
		SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
		configuration.setOnePagePerSheet(true);
		exporter.setConfiguration(configuration);
	
		exporter.exportReport();

		System.err.println("Report : " + sourceFile + ". XLS creation time : " + (System.currentTimeMillis() - start));
	}
}
 
Example 5
Source File: CrosstabApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void pptx() throws JRException
{
	File[] files = getFiles(new File("build/reports"), "jrprint");
	for(int i = 0; i < files.length; i++)
	{
		long start = System.currentTimeMillis();
		File sourceFile = files[i];

		JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

		File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".pptx");
	
		JRPptxExporter exporter = new JRPptxExporter();
	
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
	
		exporter.exportReport();

		System.err.println("Report : " + sourceFile + ". PPTX creation time : " + (System.currentTimeMillis() - start));
	}
}
 
Example 6
Source File: ChartThemesApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void xlsx() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/AllChartsReport.jrprint");
	Map<String, String> dateFormats = new HashMap<String, String>();
	dateFormats.put("EEE, MMM d, yyyy", "ddd, mmm d, yyyy");
	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx");
	
	JRXlsxExporter exporter = new JRXlsxExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
	SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
	configuration.setOnePagePerSheet(true);
	configuration.setDetectCellType(true);
	configuration.setFormatPatternsMap(dateFormats);
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start));
}
 
Example 7
Source File: XChartApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void xls() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/XYChart.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xls");
	
	JRXlsExporter exporter = new JRXlsExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
	SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
	configuration.setOnePagePerSheet(true);
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("XLS creation time : " + (System.currentTimeMillis() - start));
}
 
Example 8
Source File: XmlDataSourceApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void csv() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/CustomersReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".csv");
	
	JRCsvExporter exporter = new JRCsvExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
	//exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, "|");

	exporter.exportReport();

	System.err.println("CSV creation time : " + (System.currentTimeMillis() - start));
}
 
Example 9
Source File: IconLabelApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void ods() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/IconLabelReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".ods");
	
	JROdsExporter exporter = new JROdsExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
	SimpleOdsReportConfiguration configuration = new SimpleOdsReportConfiguration();
	configuration.setOnePagePerSheet(true);
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("ODS creation time : " + (System.currentTimeMillis() - start));
}
 
Example 10
Source File: XChartApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void xls() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/XChartReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xls");
	
	JRXlsExporter exporter = new JRXlsExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
	SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
	configuration.setOnePagePerSheet(true);
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("XLS creation time : " + (System.currentTimeMillis() - start));
}
 
Example 11
Source File: MondrianApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void xlsx() throws JRException
{
	File[] files = getFiles(new File("build/reports"), "jrprint");
	for(int i = 0; i < files.length; i++)
	{
		long start = System.currentTimeMillis();
		File sourceFile = files[i];

		JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

		File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx");
	
		JRXlsxExporter exporter = new JRXlsxExporter();
	
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
		SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
		configuration.setOnePagePerSheet(true);
		exporter.setConfiguration(configuration);
	
		exporter.exportReport();

		System.err.println("Report : " + sourceFile + ". XLSX creation time : " + (System.currentTimeMillis() - start));
	}
}
 
Example 12
Source File: CrosstabApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void xlsx() throws JRException
{
	File[] files = getFiles(new File("build/reports"), "jrprint");
	for(int i = 0; i < files.length; i++)
	{
		long start = System.currentTimeMillis();
		File sourceFile = files[i];

		JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

		File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".xlsx");
	
		JRXlsxExporter exporter = new JRXlsxExporter();
	
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
		SimpleXlsxReportConfiguration configuration = new SimpleXlsxReportConfiguration();
		configuration.setOnePagePerSheet(true);
		exporter.setConfiguration(configuration);
	
		exporter.exportReport();

		System.err.println("Report : " + sourceFile + ". XLSX creation time : " + (System.currentTimeMillis() - start));
	}
}
 
Example 13
Source File: JasperFillManager.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Fills the compiled report design loaded from the supplied input stream and writes
 * the generated report object to the output stream specified by the second parameter.
 * 
 * @param inputStream  input stream to read the compiled report design object from
 * @param outputStream output stream to write the generated report object to
 * @param parameters   report parameters map
 * @see JRFiller#fill(JasperReportsContext, JasperReport, Map)
 */
public void fillToStream(
	InputStream inputStream, 
	OutputStream outputStream, 
	Map<String,Object> parameters
	) throws JRException
{
	JasperReport jasperReport = (JasperReport)JRLoader.loadObject(inputStream);

	fillToStream(jasperReport, outputStream, parameters);
}
 
Example 14
Source File: TableOfContentsApp.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 *
 */
public void docx() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/TableOfContentsReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".docx");
	
	JRDocxExporter exporter = new JRDocxExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
	
	exporter.exportReport();

	System.err.println("DOCX creation time : " + (System.currentTimeMillis() - start));
}
 
Example 15
Source File: MapApp.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 *
 */
public void odt() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/MapReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".odt");
	
	JROdtExporter exporter = new JROdtExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
	
	exporter.exportReport();

	System.err.println("ODT creation time : " + (System.currentTimeMillis() - start));
}
 
Example 16
Source File: TabularApp.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 *
 */
public void pptx() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/TabularReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".pptx");
	
	JRPptxExporter exporter = new JRPptxExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));

	exporter.exportReport();

	System.err.println("PPTX creation time : " + (System.currentTimeMillis() - start));
}
 
Example 17
Source File: I18nApp.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 *
 */
public void csv() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/I18nReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".csv");
	
	JRCsvExporter exporter = new JRCsvExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
	
	exporter.exportReport();

	System.err.println("CSV creation time : " + (System.currentTimeMillis() - start));
}
 
Example 18
Source File: StylesApp.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 *
 */
public void pptx() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/StylesReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".pptx");
	
	JRPptxExporter exporter = new JRPptxExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));

	exporter.exportReport();

	System.err.println("PPTX creation time : " + (System.currentTimeMillis() - start));
}
 
Example 19
Source File: QueryApp.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 *
 */
public void rtf() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/QueryReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf");
	
	JRRtfExporter exporter = new JRRtfExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
	
	exporter.exportReport();

	System.err.println("RTF creation time : " + (System.currentTimeMillis() - start));
}
 
Example 20
Source File: ImagesApp.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
 *
 */
public void rtf() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/ImagesReport.jrprint");

	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);

	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf");
	
	JRRtfExporter exporter = new JRRtfExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
	
	exporter.exportReport();

	System.err.println("RTF creation time : " + (System.currentTimeMillis() - start));
}