Java Code Examples for net.sf.jasperreports.engine.JasperFillManager#fillReportToFile()

The following examples show how to use net.sf.jasperreports.engine.JasperFillManager#fillReportToFile() . 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: XlsFeaturesApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	Map<String, Object> parameters = new HashMap<String, Object>();
	parameters.put("ReportTitle", "Customers Report");
	parameters.put("Customers", "Customers");
	parameters.put("ReportDate", new Date());
	parameters.put("DataFile", "CsvDataSource.txt - CSV query executer");

	File[] files = getFiles(new File("build/reports"), "jasper");
	for(int i = 0; i< files.length; i++)
	{
		long start = System.currentTimeMillis();
		File sourceFile = files[i];
		JasperFillManager.fillReportToFile(sourceFile.getPath(), new HashMap<String, Object>(parameters));
		System.err.println("Report : " + sourceFile + ". Filling time : " + (System.currentTimeMillis() - start));
	}
}
 
Example 2
Source File: SpiderChartApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	
	JRCsvDataSource cds = null;
	try
	{
		String[] columnNames = new String[]{"value", "series", "category"};

		cds = new JRCsvDataSource(JRLoader.getLocationInputStream("data/spiderDatasource.csv"), "UTF-8");
		cds.setRecordDelimiter("\n");
		cds.setUseFirstRowAsHeader(false);
		cds.setColumnNames(columnNames);
	}
	catch (UnsupportedEncodingException e)
	{
		throw new JRException(e);
	}
	
	JasperFillManager.fillReportToFile("build/reports/SpiderChart.jasper", null, cds);
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 3
Source File: XChartApp.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	Map<String, Object> parameters = new HashMap<String, Object>();
	try
	{
		JRCsvDataSource xyds = new JRCsvDataSource(JRLoader.getLocationInputStream("data/xyDatasource.csv"), "UTF-8");
		xyds.setRecordDelimiter("\r\n");
		xyds.setUseFirstRowAsHeader(true);
		parameters.put("xyDatasource", xyds);
	}
	catch (Exception e)
	{
		throw new JRException(e);
	}
	JasperFillManager.fillReportToFile("build/reports/XYChart.jasper", new HashMap<String, Object>(parameters), new JREmptyDataSource());
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 4
Source File: ChartThemesApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	Map<String, Object> parameters = new HashMap<String, Object>();
	
	putDataSources(parameters);
	
	JasperFillManager.fillReportToFile("build/reports/AllChartsReport.jasper", new HashMap<String, Object>(parameters));
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 5
Source File: JavaScriptApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	JasperFillManager.fillReportToFile("build/reports/JavaScriptReport.jasper", null, new JREmptyDataSource());
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 6
Source File: HtmlComponentApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	JasperFillManager.fillReportToFile("build/reports/HtmlComponentReport.jasper", null, new JREmptyDataSource());
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 7
Source File: I18nApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fillDefault() throws JRException
{
	long start = System.currentTimeMillis();
	Map<String, Object> parameters = new HashMap<String, Object>();
	parameters.put("number", 1234567 + Math.random());
	JasperFillManager.fillReportToFile("build/reports/I18nReport.jasper", parameters, new JREmptyDataSource());
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 8
Source File: ScriptletApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	//Preparing parameters
	Map<String, Object> parameters = new HashMap<String, Object>();
	parameters.put("ReportTitle", "Address Report");
	
	JasperFillManager.fillReportToFile("build/reports/ScriptletReport.jasper", parameters, getDemoHsqldbConnection());
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 9
Source File: TabularApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	JasperFillManager.fillReportToFile("build/reports/TabularReport.jasper", null, new JREmptyDataSource(50));
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 10
Source File: MapApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	JasperFillManager.fillReportToFile("build/reports/MapReport.jasper", null, new JREmptyDataSource(5));
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 11
Source File: StyledTextApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	JasperFillManager.fillReportToFile("build/reports/StyledTextReport.jasper", null, new JREmptyDataSource());
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 12
Source File: UnicodeApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	JasperFillManager.fillReportToFile("build/reports/UnicodeReport.jasper", null, new JREmptyDataSource());
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 13
Source File: FontsApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	JasperFillManager.fillReportToFile("build/reports/FontsReport.jasper", null);
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 14
Source File: StretchApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	JasperFillManager.fillReportToFile("build/reports/StretchReport.jasper", null, new JREmptyDataSource(20));
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 15
Source File: RotationApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	JasperFillManager.fillReportToFile("build/reports/RotationReport.jasper", null);
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 16
Source File: XlsFormulaApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	JasperFillManager.fillReportToFile("build/reports/XlsFormulaReport.jasper", null, new JREmptyDataSource());
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 17
Source File: DataSourceApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill2() throws JRException
{
	long start = System.currentTimeMillis();
	//Preparing parameters
	Map<String, Object> parameters = new HashMap<String, Object>();
	parameters.put("ReportTitle", "Address Report");
	parameters.put("DataFile", "CustomTableModel.java");

	JasperFillManager.fillReportToFile("build/reports/DataSourceReport.jasper", parameters, new JRTableModelDataSource(new CustomTableModel()));
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 18
Source File: ParagraphsApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	JasperFillManager.fillReportToFile("build/reports/ParagraphsReport.jasper", null);
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 19
Source File: JsonDataSourceApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	long start = System.currentTimeMillis();
	Map<String, Object> params = new HashMap<String, Object>();
	params.put(JsonQueryExecuterFactory.JSON_DATE_PATTERN, "yyyy-MM-dd");
	params.put(JsonQueryExecuterFactory.JSON_NUMBER_PATTERN, "#,##0.##");
	params.put(JsonQueryExecuterFactory.JSON_LOCALE, Locale.ENGLISH);
	params.put(JRParameter.REPORT_LOCALE, Locale.US);
	
	JasperFillManager.fillReportToFile("build/reports/JsonCustomersReport.jasper", params);
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
 
Example 20
Source File: CustomVisualizationApp.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 *
 */
public void fill() throws JRException
{
	File[] files = getFiles(new File("build/reports"), "jasper");
	for (int i = 0; i < files.length; i++)
	{
		File reportFile = files[i];
		long start = System.currentTimeMillis();
		JasperFillManager.fillReportToFile(
			reportFile.getAbsolutePath(), 
			null 
			);
		System.err.println("Report : " + reportFile + ". Filling time : " + (System.currentTimeMillis() - start));
	}
}