当前位置: 首页>>代码示例>>Java>>正文


Java SimpleWriterExporterOutput类代码示例

本文整理汇总了Java中net.sf.jasperreports.export.SimpleWriterExporterOutput的典型用法代码示例。如果您正苦于以下问题:Java SimpleWriterExporterOutput类的具体用法?Java SimpleWriterExporterOutput怎么用?Java SimpleWriterExporterOutput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SimpleWriterExporterOutput类属于net.sf.jasperreports.export包,在下文中一共展示了SimpleWriterExporterOutput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: saveTxtReportToFile

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 * Generates a plain text report from a pre-compiled report and returns it into a file.
 * 
 * @param jasperPrint
 *          JasperPrint object which contains a compiled report.
 * @param file
 *          The file used to return the report.
 * @throws JRException
 *           In case there is any error generating the report an exception is thrown with the
 *           error message.
 */
private static void saveTxtReportToFile(JasperPrint jasperPrint, File file) throws JRException {
  final JRTextExporter textExporter = new JRTextExporter();
  SimpleExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
  SimpleWriterExporterOutput exporterOutput = new SimpleWriterExporterOutput(file);

  // Default text configuration that can be overridden in the .jrxml template itself
  SimpleTextExporterConfiguration textExporterConfiguration = new SimpleTextExporterConfiguration();
  textExporterConfiguration.setOverrideHints(false);
  textExporter.setConfiguration(textExporterConfiguration);
  // Default item text configuration that can be overridden in the .jrxml template itself
  SimpleTextReportConfiguration textReportConfiguration = new SimpleTextReportConfiguration();
  textReportConfiguration.setCharHeight(new Float(TEXT_CHAR_HEIGHT));
  textReportConfiguration.setCharWidth(new Float(TEXT_CHAR_WIDTH));
  textReportConfiguration.setOverrideHints(false);
  textExporter.setConfiguration(textReportConfiguration);

  textExporter.setExporterInput(exporterInput);
  textExporter.setExporterOutput(exporterOutput);
  textExporter.exportReport();
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:32,代码来源:ReportingUtils.java

示例2: saveTxtReportToOutputStream

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 * Generates a plain text report from a pre-compiled report and returns it into an output stream.
 * 
 * @param jasperPrint
 *          JasperPrint object which contains a compiled report.
 * @param outputStream
 *          The output stream used to return the report.
 * @throws JRException
 *           In case there is any error generating the report an exception is thrown with the
 *           error message.
 */
private static void saveTxtReportToOutputStream(JasperPrint jasperPrint, OutputStream outputStream)
    throws JRException {
  final JRTextExporter textExporter = new JRTextExporter();
  SimpleExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
  SimpleWriterExporterOutput exporterOutput = new SimpleWriterExporterOutput(outputStream);

  // Default text configuration that can be overridden in the .jrxml template itself
  SimpleTextExporterConfiguration textExporterConfiguration = new SimpleTextExporterConfiguration();
  textExporterConfiguration.setOverrideHints(false);
  textExporter.setConfiguration(textExporterConfiguration);
  // Default item text configuration that can be overridden in the .jrxml template itself
  SimpleTextReportConfiguration textReportConfiguration = new SimpleTextReportConfiguration();
  textReportConfiguration.setCharHeight(new Float(TEXT_CHAR_HEIGHT));
  textReportConfiguration.setCharWidth(new Float(TEXT_CHAR_WIDTH));
  textReportConfiguration.setOverrideHints(false);
  textExporter.setConfiguration(textReportConfiguration);

  textExporter.setExporterInput(exporterInput);
  textExporter.setExporterOutput(exporterOutput);
  textExporter.exportReport();
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:33,代码来源:ReportingUtils.java

示例3: rtf

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
public void rtf() 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() + ".rtf");
	
		JRRtfExporter exporter = new JRRtfExporter();
	
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
	
		exporter.exportReport();

		System.err.println("Report : " + sourceFile + ". RTF creation time : " + (System.currentTimeMillis() - start));
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:26,代码来源:MondrianApp.java

示例4: csv

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:XmlDataSourceApp.java

示例5: csv

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
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));
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:26,代码来源:ListApp.java

示例6: rtf

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
public void rtf() 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() + ".rtf");
		
		JRRtfExporter exporter = new JRRtfExporter();
		
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
		exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
		
		exporter.exportReport();

		System.err.println("Report : " + sourceFile + ". RTF creation time : " + (System.currentTimeMillis() - start));
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:26,代码来源:CsvDataSourceApp.java

示例7: csv

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
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));
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:26,代码来源:CsvDataSourceApp.java

示例8: csv

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
public void csv() 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() + ".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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:23,代码来源:JsonDataSourceApp.java

示例9: text

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
public void text() throws JRException
{
	long start = System.currentTimeMillis();
	JRTextExporter exporter = new JRTextExporter();
	File sourceFile = new File("build/reports/TextReport.jrprint");
	JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
	File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".txt");

	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
	exporter.exportReport();

	System.err.println("Text creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:18,代码来源:TextApp.java

示例10: rtf

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
public void rtf() 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() + ".rtf");
	
	JRRtfExporter exporter = new JRRtfExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
	SimpleRtfReportConfiguration configuration = new SimpleRtfReportConfiguration();
	configuration.setProgressMonitor(new SimpleExportProgressMonitor());
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("RTF creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:ScriptletApp.java

示例11: csv

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
public void csv() 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() + ".csv");
	
	JRCsvExporter exporter = new JRCsvExporter();
	
	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
	SimpleCsvReportConfiguration configuration = new SimpleCsvReportConfiguration();
	configuration.setProgressMonitor(new SimpleExportProgressMonitor());
	exporter.setConfiguration(configuration);
	
	exporter.exportReport();

	System.err.println("CSV creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:ScriptletApp.java

示例12: rtf

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
public void rtf() 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"));
	
	JRRtfExporter exporter = new JRRtfExporter();
	
	exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
	exporter.setExporterOutput(new SimpleWriterExporterOutput("build/reports/BatchExportReport.rtf"));
	
	exporter.exportReport();

	System.err.println("RTF creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:21,代码来源:BatchExportApp.java

示例13: csv

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
public void csv() 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"));
	
	JRCsvExporter exporter = new JRCsvExporter();
	
	exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
	exporter.setExporterOutput(new SimpleWriterExporterOutput("build/reports/BatchExportReport.csv"));
	
	exporter.exportReport();

	System.err.println("CSV creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:21,代码来源:BatchExportApp.java

示例14: saveCsvReportToOutputStream

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 * Generates a CSV report from a pre-compiled report and returns it into an output stream.
 * 
 * @param jasperPrint
 *          JasperPrint object which contains a compiled report.
 * @param outputStream
 *          The output stream used to return the report.
 * @throws JRException
 *           In case there is any error generating the report an exception is thrown with the
 *           error message.
 */
private static void saveCsvReportToOutputStream(JasperPrint jasperPrint, OutputStream outputStream)
    throws JRException {
  final JRCsvExporter csvExporter = new JRCsvExporter();
  SimpleExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
  SimpleWriterExporterOutput exporterOutput = new SimpleWriterExporterOutput(outputStream);

  csvExporter.setConfiguration(new SimpleCsvReportConfiguration());
  csvExporter.setExporterInput(exporterInput);
  csvExporter.setExporterOutput(exporterOutput);
  csvExporter.exportReport();
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:23,代码来源:ReportingUtils.java

示例15: jsonMetadata

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
public void jsonMetadata() throws JRException
{
	long start = System.currentTimeMillis();
	JasperReport subreport = (JasperReport)JRLoader.loadObjectFromFile("build/reports/ProductReport.jasper");

	//Preparing parameters
	Map<String, Object> parameters = new HashMap<String, Object>();
	parameters.put("ProductsSubreport", subreport);
	parameters.put(JRParameter.IS_IGNORE_PAGINATION, true);
	
	JasperPrint jasperPrint = JasperFillManager.fillReport("build/reports/MasterReport.jasper", parameters, getDemoHsqldbConnection());
	System.err.println("Filling time : " + (System.currentTimeMillis() - start));
	
	start = System.currentTimeMillis();

	File destFile = new File(new File("build/reports"), jasperPrint.getName() + ".json");

	JsonMetadataExporter exporter = new JsonMetadataExporter();

	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));

	exporter.exportReport();

	System.err.println("JSON creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:30,代码来源:SubreportApp.java


注:本文中的net.sf.jasperreports.export.SimpleWriterExporterOutput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。