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


Java JRXlsExporterParameter类代码示例

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


JRXlsExporterParameter类属于net.sf.jasperreports.engine.export包,在下文中一共展示了JRXlsExporterParameter类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: xlsx

import net.sf.jasperreports.engine.export.JRXlsExporterParameter; //导入依赖的package包/类
/**
 *
 */
public void xlsx() 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() + ".xlsx");
	
	JRXlsxExporter exporter = new JRXlsxExporter();
	
	exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
	exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
	exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
	
	exporter.exportReport();

	System.err.println("XLSX creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:23,代码来源:ScriptletApp.java

示例2: xls

import net.sf.jasperreports.engine.export.JRXlsExporterParameter; //导入依赖的package包/类
/**
 *
 */
public void xls() 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() + ".xls");
	
	JRXlsExporter exporter = new JRXlsExporter();
	
	exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
	exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
	exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
	
	exporter.exportReport();

	System.err.println("XLS creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:23,代码来源:ScriptletApp.java

示例3: jxl

import net.sf.jasperreports.engine.export.JRXlsExporterParameter; //导入依赖的package包/类
/**
 *
 */
public void jxl() 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() + ".jxl.xls");
	
	JExcelApiExporter exporter = new JExcelApiExporter();
	
	exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
	exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
	exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
	
	exporter.exportReport();

	System.err.println("XLS creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:23,代码来源:ScriptletApp.java

示例4: ods

import net.sf.jasperreports.engine.export.JRXlsExporterParameter; //导入依赖的package包/类
/**
 *
 */
public void ods() 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() + ".ods");
	
	JROdsExporter exporter = new JROdsExporter();
	
	exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
	exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());
	exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE);
	
	exporter.exportReport();

	System.err.println("ODS creation time : " + (System.currentTimeMillis() - start));
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:23,代码来源:ScriptletApp.java

示例5: exportToXLS

import net.sf.jasperreports.engine.export.JRXlsExporterParameter; //导入依赖的package包/类
private void exportToXLS() {
    log.debug("exporting to XLS");
    xlsExporter = new JRXlsExporter();
    setExportParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE,
            Boolean.TRUE);
    setExportParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,
            Boolean.FALSE);
    xlsExporter.setParameters(getExportParameters());
    try {
        start = System.currentTimeMillis();
        xlsExporter.exportReport();
        log.info("export running time (msec): "
                + (System.currentTimeMillis() - start));
    } catch (JRException jre) {
        jre.printStackTrace();
        log.error(jre.getMessage());
    }
}
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:19,代码来源:OOReportGenerator.java

示例6: renderAsXlsWithExporterParameters

import net.sf.jasperreports.engine.export.JRXlsExporterParameter; //导入依赖的package包/类
@Test
public void renderAsXlsWithExporterParameters() throws Exception {
	ByteArrayOutputStream os = new ByteArrayOutputStream();
	Map<JRExporterParameter, Object> exporterParameters = new HashMap<JRExporterParameter, Object>();

	SimpleProgressMonitor monitor = new SimpleProgressMonitor();
	exporterParameters.put(JRXlsExporterParameter.PROGRESS_MONITOR, monitor);

	JasperReportsUtils.renderAsXls(getReport(), getParameters(), getData(), os, exporterParameters);
	byte[] output = os.toByteArray();
	assertXlsOutputCorrect(output);
	assertTrue(monitor.isInvoked());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:14,代码来源:JasperReportsUtilsTests.java

示例7: exportReportToExcelStream

import net.sf.jasperreports.engine.export.JRXlsExporterParameter; //导入依赖的package包/类
private void exportReportToExcelStream(JasperPrint jasperPrint, OutputStream os)
 			throws JRException{
 	JRXlsExporter exp = new JRXlsExporter();
 	exp.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exp.setParameter(JRExporterParameter.OUTPUT_STREAM, os);
exp.setParameter(JRXlsExporterParameter.IGNORE_PAGE_MARGINS, Boolean.TRUE);
exp.setParameter(JRXlsExporterParameter.OFFSET_X, 0);
exp.setParameter(JRXlsExporterParameter.IS_IGNORE_CELL_BORDER, Boolean.FALSE);
exp.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, true);
exp.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, false);
     	exp.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, false);
     	exp.setParameter(JRXlsExporterParameter.MAXIMUM_ROWS_PER_SHEET,Integer.decode("65000"));
 	exp.exportReport();
 }
 
开发者ID:williamgrosset,项目名称:OSCAR-ConCert,代码行数:15,代码来源:OscarDocumentCreator.java

示例8: getJREXporter

import net.sf.jasperreports.engine.export.JRXlsExporterParameter; //导入依赖的package包/类
private static JRExporter getJREXporter(final String extension) {
		if ("pdf".equalsIgnoreCase(extension)) {
			JRPdfExporter exporter = new JRPdfExporter();
//			exporter.setParameter(JRPdfExporterParameter.PDF_JAVASCRIPT, "this.print();");
			
			return exporter;
			
		} else if ("html".equalsIgnoreCase(extension)) {
			return new JRHtmlExporter();
			
		} else if ("xls".equalsIgnoreCase(extension)) {
			 JRXlsExporter exporterXLS = new JRXlsExporter();                
			 exporterXLS.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
			 exporterXLS.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);
			 exporterXLS.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);
			 exporterXLS.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);
			
			return exporterXLS;
			
		} else if ("txt".equalsIgnoreCase(extension)) {
			return new JRTextExporter();
		} else if ("csv".equalsIgnoreCase(extension)) {
			return new JRCsvExporter();
		} else if ("docx".equalsIgnoreCase(extension)) {
			return new JRDocxExporter();
		}
		return null;
	}
 
开发者ID:ldiaz,项目名称:laboratorioSpring,代码行数:29,代码来源:ReportJR.java

示例9: generateExcel

import net.sf.jasperreports.engine.export.JRXlsExporterParameter; //导入依赖的package包/类
@Override
public byte[] generateExcel(List<ExcelSheetReportData> excelSheetsReportData)
		throws Exception {

	if (excelSheetsReportData == null || excelSheetsReportData.size() == 0) {
		throw new Exception("There are no data to make report.");
	}

	String[] sheetNamesArray = new String[excelSheetsReportData.size()];
	List<JasperPrint> jasperPrints = new ArrayList<JasperPrint>();
	int i = 0;
	for (ExcelSheetReportData excelSheetReportData : excelSheetsReportData) {
		sheetNamesArray[i] = excelSheetReportData.getSheetName();
		i++;

		JRDataSource reportDataSource = new JRMapCollectionDataSource(
				excelSheetReportData.getSheetData());
		JasperPrint jasperPrint = null;
		if (excelSheetReportData.getSheetReportLocation() != null
				&& !excelSheetReportData.getSheetReportLocation()
						.equals("")) {
			jasperPrint = JasperFillManager.fillReport(
					excelSheetReportData.getSheetReportLocation(),
					excelSheetReportData.getSheetParameters(),
					reportDataSource);
		} else {
			jasperPrint = JasperFillManager.fillReport(
					excelSheetReportData.getSheetReport(),
					excelSheetReportData.getSheetParameters(),
					reportDataSource);
		}
		jasperPrints.add(jasperPrint);
	}

	JasperPrint firstJasperPrint = jasperPrints.get(0);
	if (jasperPrints.size() > 1) {
		for (i = 1; i < jasperPrints.size(); i++) {
			List<JRPrintPage> additionalPages = new ArrayList<JRPrintPage>(
					jasperPrints.get(i).getPages());
			int fistJasperPrintPages = firstJasperPrint.getPages().size();
			for (int count = 0; count < additionalPages.size(); count++) {
				firstJasperPrint.addPage(fistJasperPrintPages,
						additionalPages.get(count));
			}
		}
	}

	JRExporter exporter = new JExcelApiExporter();
	exporter.setParameter(JRXlsExporterParameter.JASPER_PRINT,
			firstJasperPrint);
	exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE,
			Boolean.TRUE);
	exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,
			Boolean.FALSE);

	exporter.setParameter(
			JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,
			Boolean.TRUE);
	exporter.setParameter(
			JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS,
			Boolean.TRUE);
	exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,
			Boolean.TRUE);
	exporter.setParameter(JRXlsExporterParameter.SHEET_NAMES,
			sheetNamesArray);
	exporter.setParameter(JExcelApiExporterParameter.IS_COLLAPSE_ROW_SPAN,
			Boolean.TRUE);
	ByteArrayOutputStream outputStream = new ByteArrayOutputStream(32768);
	exporter.setParameter(JRXlsExporterParameter.OUTPUT_STREAM,
			outputStream);
	// exporter.setParameter(JRXlsExporterParameter.OUTPUT_FILE_NAME,
	// "C:/development/workspaces/jasper/report1.xls");
	exporter.exportReport();
	return outputStream.toByteArray();
}
 
开发者ID:Appverse,项目名称:appverse-server,代码行数:76,代码来源:ReportServiceImpl.java

示例10: testRenderAsXlsWithExporterParameters

import net.sf.jasperreports.engine.export.JRXlsExporterParameter; //导入依赖的package包/类
public void testRenderAsXlsWithExporterParameters() throws Exception {
	ByteArrayOutputStream os = new ByteArrayOutputStream();
	Map<JRExporterParameter, Object> exporterParameters = new HashMap<JRExporterParameter, Object>();

	SimpleProgressMonitor monitor = new SimpleProgressMonitor();
	exporterParameters.put(JRXlsExporterParameter.PROGRESS_MONITOR, monitor);

	JasperReportsUtils.renderAsXls(getReport(), getParameters(), getData(), os, exporterParameters);
	byte[] output = os.toByteArray();
	assertXlsOutputCorrect(output);
	assertTrue(monitor.isInvoked());
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:13,代码来源:JasperReportsUtilsTests.java

示例11: getExcel

import net.sf.jasperreports.engine.export.JRXlsExporterParameter; //导入依赖的package包/类
public static byte[] getExcel(JasperPrint jasperPrint, Map<String, Boolean> xlsParameters)
            throws JRException {
        byte[] content = null;
        ByteArrayOutputStream baos = null;
        try {
            baos = new ByteArrayOutputStream();
            JRXlsExporter exporter = new JRXlsExporter();
//            System.out.println("XLS Parameters");
//            System.out.println("--------------");
//            System.out.println("isDetectCellType=" + xlsParameters.get(JasperUtil.IS_DETECT_CELL_TYPE));
//            System.out.println("isWhitePageBackground=" + xlsParameters.get(JasperUtil.IS_WHITE_PAGE_BACKGROUND));
//            System.out.println("isRemoveEmptySpaceBetweenRows=" + xlsParameters.get(JasperUtil.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS));
            exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, xlsParameters.get(JasperUtil.IS_WHITE_PAGE_BACKGROUND));
            exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, xlsParameters.get(JasperUtil.IS_DETECT_CELL_TYPE));
            exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, xlsParameters.get(JasperUtil.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS));
            content = getBytes(exporter, baos, jasperPrint);
        } finally {
            if (baos != null) {
                try {
                    baos.flush();
                    baos.close();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        return content;
    }
 
开发者ID:nextreports,项目名称:nextreports-server,代码行数:29,代码来源:JasperReportsUtil.java


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