本文整理汇总了Java中net.sf.jasperreports.export.SimpleExporterInput类的典型用法代码示例。如果您正苦于以下问题:Java SimpleExporterInput类的具体用法?Java SimpleExporterInput怎么用?Java SimpleExporterInput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SimpleExporterInput类属于net.sf.jasperreports.export包,在下文中一共展示了SimpleExporterInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: saveHTMLReportToFile
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
/**
* Generates an HTML report from a pre-compiled report and returns it into a file.
*
* @param jasperPrint
* JasperPrint object which contains a compiled report.
* @param exportParameters
* Export parameters than can be added to configure the resulting 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 saveHTMLReportToFile(JasperPrint jasperPrint,
Map<Object, Object> exportParameters, File file) throws JRException {
final HtmlExporter htmlExporter = new HtmlExporter();
SimpleExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
SimpleHtmlExporterOutput exporterOutput = new SimpleHtmlExporterOutput(file);
if (exportParameters != null && exportParameters.size() > 0) {
SimpleHtmlReportConfiguration exportConfiguration = new SimpleHtmlReportConfiguration();
setHtmlConfigurationFromExportParameters(exportParameters, exportConfiguration,
exporterOutput);
htmlExporter.setConfiguration(exportConfiguration);
} else {
SimpleHtmlReportConfiguration reportExportConfiguration = new SimpleHtmlReportConfiguration();
reportExportConfiguration.setSizeUnit(HtmlSizeUnitEnum.POINT);
htmlExporter.setConfiguration(reportExportConfiguration);
}
htmlExporter.setExporterInput(exporterInput);
htmlExporter.setExporterOutput(exporterOutput);
htmlExporter.exportReport();
}
示例2: xls
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
/**
*
*/
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));
}
示例3: xls
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
/**
*
*/
public void xls() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/ShapesReport.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));
}
示例4: ods
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
/**
*
*/
public void ods() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/TableOfContentsReport.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));
}
示例5: ods
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
/**
*
*/
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));
}
示例6: docx
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
/**
*
*/
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));
}
示例7: ods
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
/**
*
*/
public void ods() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/HorizontalReport.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));
}
示例8: xls
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
/**
*
*/
public void xls() 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() + ".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("Report : " + sourceFile + ". XLS creation time : " + (System.currentTimeMillis() - start));
}
}
示例9: csv
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的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));
}
}
示例10: rtf
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的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));
}
示例11: xlsx
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
/**
*
*/
public void xlsx() 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() + ".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));
}
示例12: ods
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
/**
*
*/
public void ods() 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() + ".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("Report : " + sourceFile + ". ODS creation time : " + (System.currentTimeMillis() - start));
}
}
示例13: pptx
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
/**
*
*/
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));
}
}
示例14: print
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
@Override
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
if (Thread.interrupted())
{
throw new PrinterException("Current thread interrupted.");
}
pageIndex += pageOffset;
if ( pageIndex < 0 || pageIndex >= jasperPrint.getPages().size() )
{
return Printable.NO_SUCH_PAGE;
}
try
{
JRGraphics2DExporter exporter = new JRGraphics2DExporter(jasperReportsContext);
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
SimpleGraphics2DExporterOutput output = new SimpleGraphics2DExporterOutput();
output.setGraphics2D((Graphics2D)graphics);
exporter.setExporterOutput(output);
SimpleGraphics2DReportConfiguration configuration = new SimpleGraphics2DReportConfiguration();
configuration.setPageIndex(pageIndex);
exporter.setConfiguration(configuration);
exporter.exportReport();
}
catch (JRException e)
{
if (log.isDebugEnabled())
{
log.debug("Print failed.", e);
}
throw new PrinterException(e.getMessage()); //NOPMD
}
return Printable.PAGE_EXISTS;
}
示例15: docx
import net.sf.jasperreports.export.SimpleExporterInput; //导入依赖的package包/类
/**
*
*/
public void docx() 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() + ".docx");
JRDocxExporter exporter = new JRDocxExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(destFile));
exporter.exportReport();
System.err.println("Report : " + sourceFile + ". DOCX creation time : " + (System.currentTimeMillis() - start));
}
}