• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SimpleWriterExporterOutput类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: save

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
@Override
public void save(JasperPrint jasperPrint, File file) throws JRException
{
	if (!file.getName().toLowerCase().endsWith(EXTENSION_CSV))
	{
		file = new File(file.getAbsolutePath() + EXTENSION_CSV);
	}
	
	if (
		!file.exists() ||
		JOptionPane.OK_OPTION == 
			JOptionPane.showConfirmDialog(
				null, 
				MessageFormat.format(
					getBundleString("file.exists"),
					new Object[]{file.getName()}
					), 
				getBundleString("save"), 
				JOptionPane.OK_CANCEL_OPTION
				)
		)
	{
		JRCsvExporter exporter = new JRCsvExporter(getJasperReportsContext());
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); 
		exporter.setExporterOutput(new SimpleWriterExporterOutput(file));
		exporter.exportReport();
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:29,代码来源:JRCsvSaveContributor.java


示例17: exportCsv

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
private static void exportCsv(JasperPrint jasperPrint) throws JRException
{
	long start = System.currentTimeMillis();
	JRCsvExporter exporter = new JRCsvExporter();

	exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
	exporter.setExporterOutput(new SimpleWriterExporterOutput("build/reports/" + jasperPrint.getName() + ".csv"));

	exporter.exportReport();

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


示例18: save

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
@Override
public void save(JasperPrint jasperPrint, File file) throws JRException
{
	if(!file.getName().toLowerCase().endsWith(EXTENSION_RTF))
	{
		file = new File(file.getAbsolutePath() + EXTENSION_RTF);
	}
	
	if (
		!file.exists() ||
		JOptionPane.OK_OPTION == 
			JOptionPane.showConfirmDialog(
				null, 
				MessageFormat.format(
					getBundleString("file.exists"),
					new Object[]{file.getName()}
					), 
				getBundleString("save"), 
				JOptionPane.OK_CANCEL_OPTION
				)
		)
	{
		JRRtfExporter exporter = new JRRtfExporter(getJasperReportsContext());
		exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); 
		exporter.setExporterOutput(new SimpleWriterExporterOutput(file));
		exporter.exportReport();
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:29,代码来源:JRRtfSaveContributor.java


示例19: rtf

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
public void rtf() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/UnicodeReport.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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:22,代码来源:UnicodeApp.java


示例20: csv

import net.sf.jasperreports.export.SimpleWriterExporterOutput; //导入依赖的package包/类
/**
 *
 */
public void csv() throws JRException
{
	long start = System.currentTimeMillis();
	File sourceFile = new File("build/reports/UnicodeReport.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, "UTF-8"));

	exporter.exportReport();

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java EndpointDetails类代码示例发布时间:2022-05-22
下一篇:
Java State类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap