當前位置: 首頁>>代碼示例>>Java>>正文


Java JRExporterParameter類代碼示例

本文整理匯總了Java中net.sf.jasperreports.engine.JRExporterParameter的典型用法代碼示例。如果您正苦於以下問題:Java JRExporterParameter類的具體用法?Java JRExporterParameter怎麽用?Java JRExporterParameter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


JRExporterParameter類屬於net.sf.jasperreports.engine包,在下文中一共展示了JRExporterParameter類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: export

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的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

示例2: renderReport

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
/**
 * Perform rendering for a single Jasper Reports exporter, that is,
 * for a pre-defined output format.
 */
@Override
protected void renderReport(JasperPrint populatedReport, Map<String, Object> model, HttpServletResponse response)
		throws Exception {

	JRExporter exporter = createExporter();

	Map<JRExporterParameter, Object> mergedExporterParameters = getConvertedExporterParameters();
	if (!CollectionUtils.isEmpty(mergedExporterParameters)) {
		exporter.setParameters(mergedExporterParameters);
	}

	if (useWriter()) {
		renderReportUsingWriter(exporter, populatedReport, response);
	}
	else {
		renderReportUsingOutputStream(exporter, populatedReport, response);
	}
}
 
開發者ID:deathspeeder,項目名稱:class-guard,代碼行數:23,代碼來源:AbstractJasperReportsSingleFormatView.java

示例3: export

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
public void export(HttpServletRequest req, HttpServletResponse res)
		throws Exception {
	res.setContentType("text/xml");
	res.setHeader("Content-Disposition", "inline; filename=\"file.jrpxml\"");
	JRXmlExporter exporter = new JRXmlExporter(DefaultJasperReportsContext.getInstance());
	JasperPrint jasperPrint=this.getJasperPrint(req);
	exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
	//exporter.setParameter(JRExporterParameter.START_PAGE_INDEX, Integer.valueOf(1));
	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,代碼行數:22,代碼來源:JrpxmlExporter.java

示例4: export

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	String fileName=this.getExportFileName(req);
	fileName+=".rtf";
	res.setContentType("application/octet-stream");
	res.setHeader("Connection", "close");
	res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\"");
	JRRtfExporter exporter = new JRRtfExporter(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,代碼來源:RtfExporter.java

示例5: export

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	res.setContentType("text/html;charset=UTF-8");
	JRHtmlExporter exporter=new JRHtmlExporter(DefaultJasperReportsContext.getInstance());
	JasperPrint jasperPrint=this.getJasperPrint(req);
	req.getSession().setAttribute(BaseHttpServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrint);
	exporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
	OutputStream ouputStream = res.getOutputStream();
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, ouputStream);
	String path=req.getContextPath();
	if(path.endsWith("/")){
		path+="dorado/bdf2/jasperreports/html.image";
	}else{
		path+="/dorado/bdf2/jasperreports/html.image";			
	}
	exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,path+"?image=");
	try {
		exporter.exportReport();
	} catch (JRException e) {
		throw new ServletException(e);
	} finally {
		if (ouputStream != null) {
			ouputStream.flush();
			ouputStream.close();
		}
	}
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:27,代碼來源:HtmlExporter.java

示例6: export

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	String fileName=this.getExportFileName(req);
	fileName+=".pptx";
	res.setContentType("application/octet-stream");
	res.setHeader("Connection", "close");
	res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\"");
	JRPptxExporter exporter = new JRPptxExporter(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,代碼來源:PptxExporter.java

示例7: export

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	String fileName=this.getExportFileName(req);
	fileName+=".pdf";
	res.setContentType("application/octet-stream");
	res.setHeader("Connection", "close");
	res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\"");
	JRPdfExporter exporter = new JRPdfExporter(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,代碼來源:PdfExporter.java

示例8: export

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	String fileName=this.getExportFileName(req);
	fileName+=".csv";
	res.setContentType("application/octet-stream");
	res.setHeader("Connection", "close");
	res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\"");
	JRCsvExporter exporter = new JRCsvExporter(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,代碼來源:CsvExporter.java

示例9: export

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
public void export(HttpServletRequest req, HttpServletResponse res) throws Exception {
	String fileName=this.getExportFileName(req);
	fileName+=".docx";
	res.setContentType("application/octet-stream");
	res.setHeader("Connection", "close");
	res.setHeader("Content-Disposition", "attachment;filename=\"" + new String(fileName.getBytes("utf-8"),"ISO-8859-1") + "\"");
	JRDocxExporter exporter = new JRDocxExporter(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,代碼來源:DocxExporter.java

示例10: print

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
/**
 *
 */
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex) throws PrinterException
{
	if (Thread.currentThread().isInterrupted())
	{
		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();
		exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
		exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, graphics);
		exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
		exporter.exportReport();
	}
	catch (JRException e)
	{
		e.printStackTrace();
		throw new PrinterException(e.getMessage());
	}

	return Printable.PAGE_EXISTS;
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:34,代碼來源:JRPrinterAWT300.java

示例11: printPageToImage

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
/**
 *
 */
private Image printPageToImage(int pageIndex, float zoom) throws JRException
{
	Image pageImage = new BufferedImage(
		(int)(jasperPrint.getPageWidth() * zoom) + 1,
		(int)(jasperPrint.getPageHeight() * zoom) + 1,
		BufferedImage.TYPE_INT_RGB
		);

	JRGraphics2DExporter exporter = new JRGraphics2DExporter();
	exporter.setParameter(JRExporterParameter.JASPER_PRINT, this.jasperPrint);
	exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, pageImage.getGraphics());
	exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex));
	exporter.setParameter(JRGraphics2DExporterParameter.ZOOM_RATIO, new Float(zoom));
	exporter.exportReport();

	return pageImage;
}
 
開發者ID:iMartinezMateu,項目名稱:openbravo-pos,代碼行數:21,代碼來源:JRPrinterAWT300.java

示例12: exportToXML

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
/**
 * @param jp
 * @return
 * @throws JazzOMRJRException
 * @throws JRException
 */
protected byte[] exportToXML(JasperPrint jp) throws JazzOMRJRException {

	ByteArrayOutputStream baosXML = new ByteArrayOutputStream();

	JRXmlExporter exporter = new JRXmlExporter();
	exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baosXML);
	exporter.setParameter(JRXmlExporterParameter.IS_EMBEDDING_IMAGES, Boolean.FALSE);
	try {
		exporter.exportReport();
	} catch (JRException e1) {
		throw new JazzOMRJRException("Erro ao tentar exportar relatorio", e1);
	}

	byte[] xmlBytes = null;
	try {
		baosXML.flush();
		xmlBytes = baosXML.toByteArray();
		baosXML.close();
	} catch (IOException e) {
		throw new JazzOMRJRException("Erro ao tentar exportar relatorio", e);
	}

	return xmlBytes;
}
 
開發者ID:darciopacifico,項目名稱:omr,代碼行數:32,代碼來源:OMRModelTest.java

示例13: exportToXML

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
/**
 * @param jp
 * @return
 * @throws JazzOMRJRException
 * @throws JRException
 */
private byte[] exportToXML(JasperPrint jp) {

	ByteArrayOutputStream baosXML = new ByteArrayOutputStream();

	JRXmlExporter exporter = new JRXmlExporter();
	exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baosXML);
	exporter.setParameter(JRXmlExporterParameter.IS_EMBEDDING_IMAGES, Boolean.FALSE);
	try {
		exporter.exportReport();
	} catch (JRException e1) {
		throw new JazzOMRRuntimeException("Erro ao tentar exportar relatorio", e1);
	}

	byte[] xmlBytes = null;
	try {
		baosXML.flush();
		xmlBytes = baosXML.toByteArray();
		baosXML.close();
	} catch (IOException e) {
		throw new JazzOMRRuntimeException("Erro ao tentar exportar relatorio", e);
	}

	return xmlBytes;
}
 
開發者ID:darciopacifico,項目名稱:omr,代碼行數:32,代碼來源:ParticipationHelperWS.java

示例14: exportToXML

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
/**
 * @param jp
 * @return
 * @throws JazzOMRJRException
 * @throws JRException
 */
private byte[] exportToXML(JasperPrint jp) {

	ByteArrayOutputStream baosXML = new ByteArrayOutputStream();

	JRXmlExporter exporter = new JRXmlExporter();
	exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baosXML);
	exporter.setParameter(JRXmlExporterParameter.IS_EMBEDDING_IMAGES, Boolean.FALSE);
	try {
		exporter.exportReport();
	} catch (JRException e1) {
		throw new JazzRuntimeException("Erro ao tentar exportar relatorio", e1);
	}

	byte[] xmlBytes = null;
	try {
		baosXML.flush();
		xmlBytes = baosXML.toByteArray();
		baosXML.close();
	} catch (IOException e) {
		throw new JazzRuntimeException("Erro ao tentar exportar relatorio", e);
	}

	return xmlBytes;
}
 
開發者ID:darciopacifico,項目名稱:omr,代碼行數:32,代碼來源:ParticipationHelperWS.java

示例15: exportToXML

import net.sf.jasperreports.engine.JRExporterParameter; //導入依賴的package包/類
/**
 * @param jp
 * @return
 * @throws JazzOMRJRException
 * @throws JRException
 */
protected byte[] exportToXML(JasperPrint jp)  {

	ByteArrayOutputStream baosXML = new ByteArrayOutputStream();

	JRXmlExporter exporter = new JRXmlExporter();
	exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);
	exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baosXML);
	exporter.setParameter(JRXmlExporterParameter.IS_EMBEDDING_IMAGES, Boolean.FALSE);
	try {
		exporter.exportReport();
	} catch (JRException e1) {
		throw new JazzRuntimeException("Erro ao tentar exportar relatorio", e1);
	}

	byte[] xmlBytes = null;
	try {
		baosXML.flush();
		xmlBytes = baosXML.toByteArray();
		baosXML.close();
	} catch (IOException e) {
		throw new JazzRuntimeException("Erro ao tentar exportar relatorio", e);
	}

	return xmlBytes;
}
 
開發者ID:darciopacifico,項目名稱:omr,代碼行數:32,代碼來源:ParticipationHelper.java


注:本文中的net.sf.jasperreports.engine.JRExporterParameter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。