本文整理汇总了Java中net.sf.jasperreports.engine.DefaultJasperReportsContext类的典型用法代码示例。如果您正苦于以下问题:Java DefaultJasperReportsContext类的具体用法?Java DefaultJasperReportsContext怎么用?Java DefaultJasperReportsContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DefaultJasperReportsContext类属于net.sf.jasperreports.engine包,在下文中一共展示了DefaultJasperReportsContext类的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: viewReport
import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
/**
* @see #viewReport(JasperReportsContext, InputStream, boolean, boolean, Locale, ResourceBundle)
*/
public static void viewReport(
InputStream is,
boolean isXMLFile,
boolean isExitOnClose,
Locale locale
) throws JRException
{
viewReport(
DefaultJasperReportsContext.getInstance(),
is,
isXMLFile,
isExitOnClose,
locale,
null
);
}
示例10: JRBasePart
import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
public JRBasePart(JRPart part, JRBaseObjectFactory factory)
{
factory.put(part, this);
this.uuid = part.getUUID();
this.propertiesMap = JRPropertiesMap.getPropertiesClone(part);
this.printWhenExpression = factory.getExpression(part.getPrintWhenExpression());
this.partNameExpression = factory.getExpression(part.getPartNameExpression());
this.evaluationTime = part.getEvaluationTime();
componentKey = part.getComponentKey();
PartComponentManager manager = PartComponentsEnvironment.getInstance(DefaultJasperReportsContext.getInstance()).getManager(componentKey);
component = manager.getComponentCompiler(DefaultJasperReportsContext.getInstance()).toCompiledComponent(
part.getComponent(), factory);
if (component instanceof JRVisitable)
{
((JRVisitable) component).visit(factory);
}
}
示例11: initExcludeProperties
import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
private void initExcludeProperties()
{
JasperReportsContext context = jasperReportsContext == null
? DefaultJasperReportsContext.getInstance() : jasperReportsContext;
List<PropertySuffix> excludeProperties = JRPropertiesUtil.getInstance(context).getProperties(
PREFIX_EXCLUDE_PROPERTIES);
excludePropertiesPattern = new ArrayList<Pattern>(excludeProperties.size());
for (PropertySuffix propertySuffix : excludeProperties)
{
String regex = propertySuffix.getValue();
Pattern pattern = Pattern.compile(regex);
excludePropertiesPattern.add(pattern);
}
excludeUuids = JRPropertiesUtil.getInstance(context).getBooleanProperty(PROPERTY_EXCLUDE_UUIDS);
}
示例12: readObject
import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
/**
*
*/
private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
{
in.defaultReadObject();
if (sortFieldsMap == null)
{
sortFieldsMap = new HashMap<String, JRSortField>();
}
if (sortFieldsList == null)
{
sortFieldsList = new ArrayList<JRSortField>();
}
if (propertyExpressions == null)
{
propertyExpressions = new ArrayList<DatasetPropertyExpression>();
}
@SuppressWarnings("resource")
ContextClassLoaderObjectInputStream cclois =
in instanceof ContextClassLoaderObjectInputStream ? (ContextClassLoaderObjectInputStream)in : null;
if (cclois == null)
{
jasperReportsContext = DefaultJasperReportsContext.getInstance();
}
else
{
jasperReportsContext = cclois.getJasperReportsContext();
}
//the listener is serialized, but not added to the query.
//serializing the listener does not make much sense, it could have been easily recreated.
addQueryLanguageListener();
}
示例13: fill
import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
/**
*
*/
public void fill() throws JRException
{
long start = System.currentTimeMillis();
JRDataSource datasource = createDataSource(DefaultJasperReportsContext.getInstance(), Locale.US);
JasperFillManager.fillReportToFile("build/reports/FunctionsReport.jasper", null, datasource);
System.err.println("Filling time : " + (System.currentTimeMillis() - start));
}
示例14: getHtmlPrintElementFactory
import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
/**
* Return an {@link HtmlPrintElementFactory factory} instance.
*
* @return a HtmlPrintElementFactory instance
* @throws JRException if the {@link #PROPERTY_HTML_PRINTELEMENT_FACTORY factory property} is not defined
* or the factory cannot be instantiated.
*/
public static HtmlPrintElementFactory getHtmlPrintElementFactory() throws JRException
{
String factoryClassName = JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()).getProperty(PROPERTY_HTML_PRINTELEMENT_FACTORY);
if (factoryClassName == null)
{
factoryClassName = DefaultHtmlPrintElementFactory.class.getName();
}
return cache.getCachedInstance(factoryClassName);
}
示例15: getDefaultInstance
import net.sf.jasperreports.engine.DefaultJasperReportsContext; //导入依赖的package包/类
/**
*
*/
private static ChartUtil getDefaultInstance()//FIXMECONTEXT check this use of this
{
return new ChartUtil(DefaultJasperReportsContext.getInstance());
}