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


Java DefaultJasperReportsContext.getInstance方法代码示例

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


在下文中一共展示了DefaultJasperReportsContext.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的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: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的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

示例3: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的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

示例4: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的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

示例5: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的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

示例6: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的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

示例7: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的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

示例8: export

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的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: showReport

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的package包/类
/**
 *  Prikazuje ucitani izvestaj.
 */
public static void showReport(String xml,String fileName, Report report) {
  HashMap<String, Object> params = new HashMap<String, Object>();
  try {
  for (ReportParam p : report.getReportSettings().getParams()){
    if(p.getName().compareToIgnoreCase("subjasper")==0){
  		JasperReport subreport = (JasperReport) JRLoader.loadObject(ReportUtils.class
			.getResource(p.getValue()).openStream());
  		params.put("subjasper", subreport);
  	}else{
       params.put(p.getName(), p.getValue());
  	}
  }

  DefaultJasperReportsContext context = DefaultJasperReportsContext.getInstance(); //dodato zbog jaxena
  JRPropertiesUtil.getInstance(context).setProperty("net.sf.jasperreports.xpath.executer.factory", "net.sf.jasperreports.engine.util.xml.JaxenXPathExecuterFactory");   
    
  params.put("period", getPeriod(fileName));
    JRXmlDataSource dataSource = new JRXmlDataSource(XMLUtils
        .getDocumentFromString(xml), "/report/item");
    JasperPrint jp = JasperFillManager.fillReport(Report.class.getResource(
        report.getJasper()).openStream(), params, dataSource);
    BisisApp.getMainFrame().addReportFrame(report.getName(), jp);
  } catch (Exception ex) {
    ex.printStackTrace();
  }
}
 
开发者ID:unsftn,项目名称:bisis-v4,代码行数:30,代码来源:ReportUtils.java

示例10: ensureFontExtensions

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的package包/类
protected void ensureFontExtensions()
{
	if ((fontFamilies == null || fontSets == null) && fontFamiliesLocations != null)
	{
		SimpleFontExtensionHelper fontExtensionHelper = SimpleFontExtensionHelper.getInstance();
		DefaultJasperReportsContext context = DefaultJasperReportsContext.getInstance();
		
		FontExtensionsCollector extensionsCollector = new FontExtensionsCollector();
		for (String location : fontFamiliesLocations)
		{
			if (log.isDebugEnabled())
			{
				log.debug("Loading font extensions from " + location);
			}
			
			try
			{
				fontExtensionHelper.loadFontExtensions(context, location, extensionsCollector);
			}
			catch (JRRuntimeException e)//only catching JRRuntimeException for now
			{
				log.error("Error loading font extensions from " + location, e);
				//keeping any font extensions collected so far, though it's a little weird
			}
		}
		
		fontFamilies = extensionsCollector.getFontFamilies();
		fontSets = extensionsCollector.getFontSets();
	}
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:31,代码来源:FontExtensionsRegistry.java

示例11: getDefaultInstance

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的package包/类
/**
 *
 */
private static ChartUtil getDefaultInstance()//FIXMECONTEXT check this use of this
{
	return new ChartUtil(DefaultJasperReportsContext.getInstance());
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:8,代码来源:ChartUtil.java

示例12: JRViewer

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的package包/类
/**
 * @see #JRViewer(String, boolean, Locale, ResourceBundle)
 */
public JRViewer(String fileName, boolean isXML, Locale locale, ResourceBundle resBundle) throws JRException
{
	this(
		DefaultJasperReportsContext.getInstance(), 
		fileName, 
		isXML, 
		locale, 
		resBundle
		);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:14,代码来源:JRViewer.java

示例13: JRXlsAbstractMetadataExporter

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的package包/类
/**
 * @see #JRXlsAbstractMetadataExporter(JasperReportsContext)
 */
public JRXlsAbstractMetadataExporter()
{
	this(DefaultJasperReportsContext.getInstance());
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:8,代码来源:JRXlsAbstractMetadataExporter.java

示例14: JRGraphics2DExporter

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的package包/类
/**
 * @see #JRGraphics2DExporter(JasperReportsContext)
 */
public JRGraphics2DExporter() throws JRException
{
	this(DefaultJasperReportsContext.getInstance());
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:8,代码来源:JRGraphics2DExporter.java

示例15: JRXmlDataSource

import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的package包/类
public JRXmlDataSource(File file, String selectExpression, boolean isNamespaceAware)
		throws JRException {
	this(DefaultJasperReportsContext.getInstance(), file, selectExpression, isNamespaceAware);
}
 
开发者ID:TIBCOSoftware,项目名称:jasperreports,代码行数:5,代码来源:JRXmlDataSource.java


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