本文整理汇总了Java中net.sf.jasperreports.engine.export.JRXlsExporter类的典型用法代码示例。如果您正苦于以下问题:Java JRXlsExporter类的具体用法?Java JRXlsExporter怎么用?Java JRXlsExporter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JRXlsExporter类属于net.sf.jasperreports.engine.export包,在下文中一共展示了JRXlsExporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: xls
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
*
*/
public void xls() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/XYChart.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));
}
示例2: export
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
String fileName=this.getExportFileName(req);
fileName+=".xls";
res.setContentType("application/octet-stream");
res.setHeader("Connection", "close");
res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\"");
JRXlsExporter exporter = new JRXlsExporter(DefaultJasperReportsContext.getInstance());
JasperPrint jasperPrint=this.getJasperPrint(req);
exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
OutputStream ouputStream = res.getOutputStream();
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
try {
exporter.exportReport();
} catch (JRException e) {
throw new ServletException(e);
} finally {
if (ouputStream != null) {
ouputStream.flush();
ouputStream.close();
}
}
}
示例3: xls
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
*
*/
public void xls() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/Barcode4JReport.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));
}
示例4: xls
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
*
*/
public void xls() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/FontsReport.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));
}
示例5: xls
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的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));
}
示例6: xls
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
*
*/
public void xls() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/StyledTextReport.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));
}
示例7: xls
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
*
*/
public void xls() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/JFreeChartReport.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));
}
示例8: exportXls
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
* Xls export.
*
* @param jp
* @param os
*/
protected void exportXls(JasperPrint jp, OutputStream os) {
// Create a JRXlsExporter instance
JRXlsExporter exporter = new JRXlsExporter();
// Here we assign the parameters jp and baos to the exporter
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, os);
// TODO add Excel specific parameters
exporter.setParameter(JRXlsAbstractExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
exporter.setParameter(JRXlsAbstractExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
exporter.setParameter(JRXlsAbstractExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
try {
exporter.exportReport();
} catch (JRException e) {
throw new RuntimeException(e);
}
}
示例9: saveExcelReportToFile
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
* Generates an XLS 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 saveExcelReportToFile(JasperPrint jasperPrint,
Map<Object, Object> exportParameters, File file) throws JRException {
final JRXlsExporter excelExporter = new JRXlsExporter();
SimpleExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
SimpleOutputStreamExporterOutput exporterOutput = new SimpleOutputStreamExporterOutput(file);
if (exportParameters != null && exportParameters.size() > 0) {
SimpleXlsReportConfiguration exportConfiguration = getXlsConfigurationFromExportParameters(exportParameters);
excelExporter.setConfiguration(exportConfiguration);
} else {
SimpleXlsReportConfiguration reportExportConfiguration = new SimpleXlsReportConfiguration();
reportExportConfiguration.setOnePagePerSheet(false);
reportExportConfiguration.setRemoveEmptySpaceBetweenRows(true);
excelExporter.setConfiguration(reportExportConfiguration);
}
excelExporter.setExporterInput(exporterInput);
excelExporter.setExporterOutput(exporterOutput);
excelExporter.exportReport();
}
示例10: saveExcelReportToOutputStream
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
* Generates an XLS report from a pre-compiled report and returns it into an output stream.
*
* @param jasperPrint
* JasperPrint object which contains a compiled report.
* @param exportParameters
* Export parameters than can be added to configure the resulting 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 saveExcelReportToOutputStream(JasperPrint jasperPrint,
Map<Object, Object> exportParameters, OutputStream outputStream) throws JRException {
final JRXlsExporter excelExporter = new JRXlsExporter();
SimpleExporterInput exporterInput = new SimpleExporterInput(jasperPrint);
SimpleOutputStreamExporterOutput exporterOutput = new SimpleOutputStreamExporterOutput(
outputStream);
if (exportParameters != null && exportParameters.size() > 0) {
SimpleXlsReportConfiguration exportConfiguration = getXlsConfigurationFromExportParameters(exportParameters);
excelExporter.setConfiguration(exportConfiguration);
} else {
SimpleXlsReportConfiguration reportExportConfiguration = new SimpleXlsReportConfiguration();
reportExportConfiguration.setOnePagePerSheet(false);
reportExportConfiguration.setRemoveEmptySpaceBetweenRows(true);
excelExporter.setConfiguration(reportExportConfiguration);
}
excelExporter.setExporterInput(exporterInput);
excelExporter.setExporterOutput(exporterOutput);
excelExporter.exportReport();
}
示例11: xls
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
*
*/
public void xls() 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() + ".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));
}
示例12: xls
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
*
*/
public void xls() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/DataSourceReport.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));
}
示例13: xls
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
*
*/
public void xls() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/MapReport.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));
}
示例14: xls
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
*
*/
public void xls() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/TabularReport.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));
}
示例15: xls
import net.sf.jasperreports.engine.export.JRXlsExporter; //导入依赖的package包/类
/**
*
*/
public void xls() throws JRException
{
long start = System.currentTimeMillis();
File sourceFile = new File("build/reports/QueryReport.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));
}