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


Java JRXlsExporter类代码示例

本文整理汇总了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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:XChartApp.java

示例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();
		}
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:23,代码来源:XlsExporter.java

示例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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:Barcode4JApp.java

示例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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:FontsApp.java

示例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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:FormsApp.java

示例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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:StyledTextApp.java

示例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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:JFreeChartApp.java

示例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);
    }
}
 
开发者ID:seedstack,项目名称:io-addon,代码行数:27,代码来源:JasperRenderer.java

示例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();
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:33,代码来源:ReportingUtils.java

示例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();
}
 
开发者ID:mauyr,项目名称:openbravo-brazil,代码行数:34,代码来源:ReportingUtils.java

示例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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:UnicodeApp.java

示例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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:DataSourceApp.java

示例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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:MapApp.java

示例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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:TabularApp.java

示例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));
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:25,代码来源:QueryApp.java


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