本文整理汇总了Java中net.sf.jasperreports.engine.export.JRTextExporter.setExporterOutput方法的典型用法代码示例。如果您正苦于以下问题:Java JRTextExporter.setExporterOutput方法的具体用法?Java JRTextExporter.setExporterOutput怎么用?Java JRTextExporter.setExporterOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.jasperreports.engine.export.JRTextExporter
的用法示例。
在下文中一共展示了JRTextExporter.setExporterOutput方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveTxtReportToFile
import net.sf.jasperreports.engine.export.JRTextExporter; //导入方法依赖的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();
}
示例2: saveTxtReportToOutputStream
import net.sf.jasperreports.engine.export.JRTextExporter; //导入方法依赖的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();
}
示例3: text
import net.sf.jasperreports.engine.export.JRTextExporter; //导入方法依赖的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));
}
示例4: getExporter
import net.sf.jasperreports.engine.export.JRTextExporter; //导入方法依赖的package包/类
@Override
protected JRTextExporter getExporter(JasperReportsConfiguration jContext, JRExportProgressMonitor monitor, File file) {
JRTextExporter exp = new JRTextExporter(jContext);
exp.setExporterOutput(new SimpleWriterExporterOutput(file));
exp.setConfiguration(new SimpleTextExporterConfiguration());
SimpleTextReportConfiguration rconf = new SimpleTextReportConfiguration();
setupReportConfiguration(rconf, monitor);
exp.setConfiguration(rconf);
return exp;
}
示例5: saveTxtReport
import net.sf.jasperreports.engine.export.JRTextExporter; //导入方法依赖的package包/类
/**
* Generates a plain text report using the SimpleExporterInput, SimpleWriterExporterOutput,
* SimpleTextExporterConfiguration and SimpleTextReportConfiguration received as parameters.
*
* @param exporterInput
* SimpleExporterInput object with the input data.
* @param exporterOutput
* SimpleWriterExporterOutput object with the output data.
* @param textExporterConfiguration
* SimpleTextExporterConfiguration with the configuration data.
* @param textReportConfiguration
* SimpleTextReportConfiguration with the item configuration data.
* @throws JRException
* In case there is any error generating the report an exception is thrown with the
* error message.
*/
public static void saveTxtReport(SimpleExporterInput exporterInput,
SimpleWriterExporterOutput exporterOutput,
SimpleTextExporterConfiguration textExporterConfiguration,
SimpleTextReportConfiguration textReportConfiguration) throws JRException {
final JRTextExporter textExporter = new JRTextExporter();
textExporter.setExporterInput(exporterInput);
textExporter.setExporterOutput(exporterOutput);
textExporter.setConfiguration(textExporterConfiguration);
textExporter.setConfiguration(textReportConfiguration);
textExporter.exportReport();
}