net.sf.jasperreports.export.SimpleExporterInput Java Examples

The following examples show how to use net.sf.jasperreports.export.SimpleExporterInput. 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: BatchExportApp.java    From jasperreports with GNU Lesser General Public License v3.0 8 votes vote down vote up
/**
 *
 */
public void pdf() throws JRException
{
	long start = System.currentTimeMillis();
	List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report1.jrprint"));
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report2.jrprint"));
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report3.jrprint"));
	
	JRPdfExporter exporter = new JRPdfExporter();
	
	exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("build/reports/BatchExportReport.pdf"));
	SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();
	configuration.setCreatingBatchModeBookmarks(true);
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();
	
	System.err.println("PDF creation time : " + (System.currentTimeMillis() - start));
}
 
Example #2
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 #3
Source File: TableApp.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/TableReport.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: DataSourceApp.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/DataSourceReport.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 #5
Source File: SpiderChartApp.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/SpiderChart.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 #6
Source File: BatchExportApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void docx() throws JRException
{
	long start = System.currentTimeMillis();
	List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report1.jrprint"));
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report2.jrprint"));
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report3.jrprint"));
	
	JRDocxExporter exporter = new JRDocxExporter();
	
	exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("build/reports/BatchExportReport.docx"));
	
	exporter.exportReport();

	System.err.println("DOCX creation time : " + (System.currentTimeMillis() - start));
}
 
Example #7
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 #8
Source File: ListApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void odt() 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() + ".odt");
	
		JROdtExporter exporter = new JROdtExporter();
	
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
	
		exporter.exportReport();

		System.err.println("Report : " + sourceFile + ". ODT creation time : " + (System.currentTimeMillis() - start));
	}
}
 
Example #9
Source File: ListApp.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 #10
Source File: ListApp.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 #11
Source File: XlsxDataSourceApp.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/XlsxDataSourceReport.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 #12
Source File: BarbecueApp.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/BarbecueReport.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 #13
Source File: HibernateApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void csv() 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() + ".csv");
	
		JRCsvExporter exporter = new JRCsvExporter();
	
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
	
		exporter.exportReport();

		System.err.println("Report : " + sourceFile + ". CSV creation time : " + (System.currentTimeMillis() - start));
	}
}
 
Example #14
Source File: ParagraphsApp.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/ParagraphsReport.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 #15
Source File: FormsApp.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/FormsReport.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 #16
Source File: JsonDataSourceApp.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/JsonCustomersReport.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 #17
Source File: FormsApp.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/FormsReport.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 #18
Source File: I18nApp.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/I18nReport.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("XLS creation time : " + (System.currentTimeMillis() - start));
}
 
Example #19
Source File: I18nApp.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/I18nReport.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 #20
Source File: ScriptletApp.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/ScriptletReport.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);
	configuration.setProgressMonitor(new SimpleExportProgressMonitor());
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("XLS creation time : " + (System.currentTimeMillis() - start));
}
 
Example #21
Source File: ScriptletApp.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/ScriptletReport.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);
	configuration.setProgressMonitor(new SimpleExportProgressMonitor());
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start));
}
 
Example #22
Source File: StyledTextApp.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/StyledTextReport.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 #23
Source File: BatchExportApp.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();
	List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report1.jrprint"));
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report2.jrprint"));
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report3.jrprint"));
	
	JROdsExporter exporter = new JROdsExporter();
	
	exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("build/reports/BatchExportReport.ods"));
	SimpleOdsReportConfiguration configuration = new SimpleOdsReportConfiguration();
	configuration.setOnePagePerSheet(false);
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("ODS creation time : " + (System.currentTimeMillis() - start));
}
 
Example #24
Source File: CsvDataSourceApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void csv() 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() + ".csv");
		
		JRCsvExporter exporter = new JRCsvExporter();
		
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
		
		exporter.exportReport();

		System.err.println("Report : " + sourceFile + ". CSV creation time : " + (System.currentTimeMillis() - start));
	}
}
 
Example #25
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 #26
Source File: MapApp.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/MapReport.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 #27
Source File: MarkupApp.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/MarkupReport.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 #28
Source File: BatchExportApp.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();
	List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report1.jrprint"));
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report2.jrprint"));
	jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report3.jrprint"));
	
	JRXlsExporter exporter = new JRXlsExporter();
	
	exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
	exporter.setExporterOutput(new SimpleOutputStreamExporterOutput("build/reports/BatchExportReport.xls"));
	SimpleXlsReportConfiguration configuration = new SimpleXlsReportConfiguration();
	configuration.setOnePagePerSheet(false);
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("XLS creation time : " + (System.currentTimeMillis() - start));
}
 
Example #29
Source File: ScriptletApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void docx() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/ScriptletReport.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));
	SimpleDocxReportConfiguration configuration = new SimpleDocxReportConfiguration();
	configuration.setProgressMonitor(new SimpleExportProgressMonitor());
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("DOCX creation time : " + (System.currentTimeMillis() - start));
}
 
Example #30
Source File: TabularApp.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/TabularReport.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));
}