本文整理汇总了Java中net.sf.jasperreports.engine.export.JRRtfExporter类的典型用法代码示例。如果您正苦于以下问题:Java JRRtfExporter类的具体用法?Java JRRtfExporter怎么用?Java JRRtfExporter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JRRtfExporter类属于net.sf.jasperreports.engine.export包,在下文中一共展示了JRRtfExporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: export
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的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();
}
}
}
示例2: rtf
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
/**
*
*/
public void rtf() throws JRException
{
File[] files = getFiles(new File("build/reports"), "jrprint");
for(int i = 0; i < files.length; i++)
{
long start = System.currentTimeMillis();
File sourceFile = files[i];
JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf");
JRRtfExporter exporter = new JRRtfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
exporter.exportReport();
System.err.println("Report : " + sourceFile + ". RTF creation time : " + (System.currentTimeMillis() - start));
}
}
示例3: rtf
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
/**
*
*/
public void rtf() throws JRException
{
File[] files = getFiles(new File("build/reports"), "jrprint");
for(int i = 0; i < files.length; i++)
{
long start = System.currentTimeMillis();
File sourceFile = files[i];
JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile);
File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".rtf");
JRRtfExporter exporter = new JRRtfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
exporter.exportReport();
System.err.println("Report : " + sourceFile + ". RTF creation time : " + (System.currentTimeMillis() - start));
}
}
示例4: rtf
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
/**
*
*/
public void rtf() 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() + ".rtf");
JRRtfExporter exporter = new JRRtfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
SimpleRtfReportConfiguration configuration = new SimpleRtfReportConfiguration();
configuration.setProgressMonitor(new SimpleExportProgressMonitor());
exporter.setConfiguration(configuration);
exporter.exportReport();
System.err.println("RTF creation time : " + (System.currentTimeMillis() - start));
}
示例5: rtf
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
/**
*
*/
public void rtf() throws JRException
{
long start = System.currentTimeMillis();
List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report1.jrprint"));
jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report2.jrprint"));
jasperPrintList.add((JasperPrint)JRLoader.loadObjectFromFile("build/reports/Report3.jrprint"));
JRRtfExporter exporter = new JRRtfExporter();
exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
exporter.setExporterOutput(new SimpleWriterExporterOutput("build/reports/BatchExportReport.rtf"));
exporter.exportReport();
System.err.println("RTF creation time : " + (System.currentTimeMillis() - start));
}
示例6: exportElement
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
@Override
public void exportElement(
JRRtfExporterContext exporterContext,
JRGenericPrintElement element
)
{
try
{
JRRtfExporter exporter = (JRRtfExporter)exporterContext.getExporterRef();
exporter.exportImage(MapElementImageProvider.getImage(exporterContext.getJasperReportsContext(), element));
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
示例7: createExporter
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
private Exporter createExporter(ExportType type) {
switch (type) {
case CSV:
return new JRCsvExporter();
case RTF:
return new JRRtfExporter();
case XLS:
return new JRXlsExporter();
case ODT:
return new JROdtExporter();
case ODS:
return new JROdsExporter();
case DOCX:
return new JRDocxExporter();
case XLSX:
return new JRXlsxExporter();
case PPTX:
return new JRPptxExporter();
default:
return null;
}
}
示例8: getRtf
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
public static byte[] getRtf(JasperPrint jasperPrint) throws JRException {
byte[] content = null;
ByteArrayOutputStream baos = null;
try {
baos = new ByteArrayOutputStream();
JRRtfExporter exporter = new JRRtfExporter();
content = getBytes(exporter, baos, jasperPrint);
} finally {
if (baos != null) {
try {
baos.flush();
baos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
return content;
}
示例9: save
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
@Override
public void save(JasperPrint jasperPrint, File file) throws JRException
{
if(!file.getName().toLowerCase().endsWith(EXTENSION_RTF))
{
file = new File(file.getAbsolutePath() + EXTENSION_RTF);
}
if (
!file.exists() ||
JOptionPane.OK_OPTION ==
JOptionPane.showConfirmDialog(
null,
MessageFormat.format(
getBundleString("file.exists"),
new Object[]{file.getName()}
),
getBundleString("save"),
JOptionPane.OK_CANCEL_OPTION
)
)
{
JRRtfExporter exporter = new JRRtfExporter(getJasperReportsContext());
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleWriterExporterOutput(file));
exporter.exportReport();
}
}
示例10: exportRtf
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
public void exportRtf() throws JRException {
JRRtfExporter exporter = new JRRtfExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
exporter.setExporterOutput(new SimpleWriterExporterOutput(this.output
.getAbsolutePath() + ".rtf"));
exporter.exportReport();
}
示例11: getExporter
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
@Override
protected JRRtfExporter getExporter(JasperReportsConfiguration jContext, JRExportProgressMonitor monitor, File file) {
JRRtfExporter exp = new JRRtfExporter(jContext);
exp.setExporterOutput(new SimpleWriterExporterOutput(file));
SimpleRtfReportConfiguration rconf = new SimpleRtfReportConfiguration();
setupReportConfiguration(rconf, monitor);
exp.setConfiguration(rconf);
return exp;
}
示例12: export
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
/**
* Exports by MIME type.
*
* @param mimeType MIME type
* @param jp Jasper print
* @param os outputstream
* @throws JRException
*/
protected void export(String mimeType, JasperPrint jp, OutputStream os) throws JRException {
if ("application/pdf".equalsIgnoreCase(mimeType)) {
exportReport(new JRPdfExporter(), jp, os);
} else if ("text/xml".equalsIgnoreCase(mimeType)) {
exportReport(new HtmlExporter(), jp, os);
} else if ("application/rtf".equalsIgnoreCase(mimeType)) {
exportReport(new JRRtfExporter(), jp, os);
} else if ("application/xls".equalsIgnoreCase(mimeType)) {
exportReport(new JRXlsExporter(), jp, os);
} else if ("application/odt".equalsIgnoreCase(mimeType)) {
exportReport(new JROdtExporter(), jp, os);
} else if ("application/ods".equalsIgnoreCase(mimeType)) {
exportReport(new JROdsExporter(), jp, os);
} else if ("application/docx".equalsIgnoreCase(mimeType)) {
exportReport(new JRDocxExporter(), jp, os);
} else if ("application/xlsx".equalsIgnoreCase(mimeType)) {
exportReport(new JRXlsxExporter(), jp, os);
} else if ("application/pptx".equalsIgnoreCase(mimeType)) {
exportReport(new JRPptxExporter(), jp, os);
} else if ("text/xhmtl".equalsIgnoreCase(mimeType)) {
exportReport(new JRXhtmlExporter(), jp, os);
} else {
throw new IllegalArgumentException("JasperRenderer does not support " + mimeType + " MIME type.");
}
}
示例13: rtf
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
protected void rtf(JasperPrint print, String destFile) throws JRException, IOException {
log.debug("exporting to rtf file: " + destFile);
JRRtfExporter exporter = new JRRtfExporter();
exporter.setExporterInput(new SimpleExporterInput(print));
exporter.setExporterOutput(new SimpleWriterExporterOutput(destFile));
exporter.exportReport();
}
示例14: exportToRTF
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
private void exportToRTF() {
log.debug("exporting to RTF");
rtfExporter = new JRRtfExporter();
rtfExporter.setParameters(getExportParameters());
try {
start = System.currentTimeMillis();
rtfExporter.exportReport();
log.info("export running time (msec): "
+ (System.currentTimeMillis() - start));
} catch (JRException jre) {
jre.printStackTrace();
log.error(jre.getCause());
}
}
示例15: rtf
import net.sf.jasperreports.engine.export.JRRtfExporter; //导入依赖的package包/类
private JRRtfExporter rtf(JasperIRtfExporter jasperExporter) {
SimpleWriterExporterOutput exporterOutput = simpleWriterExporterOutput(jasperExporter);
SimpleRtfReportConfiguration reportExportConfiguration = new SimpleRtfReportConfiguration();
reportExportConfiguration(reportExportConfiguration, jasperExporter);
if (jasperExporter.getIgnoreHyperLink() != null) {
reportExportConfiguration.setIgnoreHyperlink(jasperExporter.getIgnoreHyperLink());
}
SimpleRtfExporterConfiguration exporterConfiguration = new SimpleRtfExporterConfiguration();
JRRtfExporter jrExporter = new JRRtfExporter();
jrExporter.setExporterOutput(exporterOutput);
jrExporter.setConfiguration(reportExportConfiguration);
jrExporter.setConfiguration(exporterConfiguration);
return jrExporter;
}