本文整理汇总了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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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();
}
}
示例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();
}
}
示例11: getDefaultInstance
import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的package包/类
/**
*
*/
private static ChartUtil getDefaultInstance()//FIXMECONTEXT check this use of this
{
return new ChartUtil(DefaultJasperReportsContext.getInstance());
}
示例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
);
}
示例13: JRXlsAbstractMetadataExporter
import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的package包/类
/**
* @see #JRXlsAbstractMetadataExporter(JasperReportsContext)
*/
public JRXlsAbstractMetadataExporter()
{
this(DefaultJasperReportsContext.getInstance());
}
示例14: JRGraphics2DExporter
import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入方法依赖的package包/类
/**
* @see #JRGraphics2DExporter(JasperReportsContext)
*/
public JRGraphics2DExporter() throws JRException
{
this(DefaultJasperReportsContext.getInstance());
}
示例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);
}