public class JRRtfExporter extends JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>
JRRtfExporter implementation helps
to export JasperPrint documents in RTF format using RTF Specification 1.6. This
means that the RTF files produced by this exporter are compatible with Microsoft Word
6.0, 2003 and XP.
However, users might experience some problems when opening those RTF files with
OpenOffice or StarOffice, as these products are not perfectly compatible with the RTF
specifications from Microsoft.
RTF is a character-based file format that supports absolute positioning of elements,
which means that this exporter produces output very similar to that of the Graphics2D
and PDF exporters. The RtfReportConfiguration provides special
configuration settings for this exporter.
Almost all the provided samples show how to export to RTF.RtfReportConfiguration| Modifier and Type | Class and Description |
|---|---|
protected class |
JRRtfExporter.ExporterContext |
JRAbstractExporter.BaseExporterContext, JRAbstractExporter.PageRange| Modifier and Type | Field and Description |
|---|---|
protected List<Color> |
colors |
protected FileBufferedWriter |
colorWriter |
protected FileBufferedWriter |
contentWriter |
protected File |
destFile |
static String |
EXCEPTION_MESSAGE_KEY_INVALID_TEXT_HEIGHT |
protected List<String> |
fonts |
protected FileBufferedWriter |
fontWriter |
protected static String |
JR_PAGE_ANCHOR_PREFIX |
static String |
PROPERTY_IGNORE_HYPERLINK
Deprecated.
Replaced by
RtfReportConfiguration.PROPERTY_IGNORE_HYPERLINK. |
protected RenderersCache |
renderersCache |
protected int |
reportIndex |
static String |
RTF_EXPORTER_KEY
The exporter key, as used in
GenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String). |
allSelector, crtCompositeConfiguration, crtCompositeItemConfiguration, crtItem, dateFormatCache, EXCEPTION_MESSAGE_KEY_END_PAGE_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_INVALID_IMAGE_NAME, EXCEPTION_MESSAGE_KEY_INVALID_ZOOM_RATIO, EXCEPTION_MESSAGE_KEY_MIXED_CALLS_NOT_ALLOWED, EXCEPTION_MESSAGE_KEY_OUTPUT_WRITER_ERROR, EXCEPTION_MESSAGE_KEY_PAGE_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_START_PAGE_INDEX_OUT_OF_RANGE, exporterConfiguration, exporterContext, exporterInput, exporterOutput, filter, fontUtil, itemConfiguration, jasperPrint, jasperReportsContext, noBackcolorSelector, noneSelector, numberFormatCache, parameters, propertiesUtil, PROPERTY_DEFAULT_FILTER_FACTORY, PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY, rendererUtil, styledTextUtil, textValueClasses| Constructor and Description |
|---|
JRRtfExporter() |
JRRtfExporter(JasperReportsContext jasperReportsContext) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
endHyperlink(boolean startedHyperlink) |
protected void |
ensureOutput() |
protected void |
exportElements(Collection<JRPrintElement> elements) |
protected void |
exportEllipse(JRPrintEllipse ellipse)
Draw a ellipse object
|
void |
exportFrame(JRPrintFrame frame) |
protected void |
exportGenericElement(JRGenericPrintElement element) |
protected boolean |
exportHyperlink(JRPrintHyperlink link) |
void |
exportImage(JRPrintImage printImage)
Export a image object
|
protected void |
exportLine(JRPrintLine line)
Draw a line object
|
protected void |
exportPage(JRPrintPage page,
boolean lastPage)
Exports a report page
|
protected void |
exportRectangle(JRPrintRectangle rectangle)
Draw a rectangle
|
void |
exportReport()
Performs the export.
|
protected void |
exportReportToWriter(Writer writer)
Export report in .rtf format to a stream
|
void |
exportText(JRPrintText text)
Draw a text box
|
protected Class<RtfExporterConfiguration> |
getConfigurationInterface() |
String |
getExporterKey() |
String |
getExporterPropertiesPrefix()
Returns the properties prefix for the current exporter.
|
protected Class<RtfReportConfiguration> |
getItemConfigurationInterface() |
protected void |
initExport() |
protected void |
initReport() |
protected void |
writeAnchor(String anchorName) |
protected void |
writeShapeHyperlink(JRPrintHyperlink link) |
createFilter, defaultParseNumber, ensureInput, ensureJasperReportsContext, getBooleanCellValue, getCurrentConfiguration, getCurrentItemConfiguration, getCurrentJasperPrint, getCustomHandler, getDateCellValue, getDateFormat, getExporterContext, getExporterInput, getExporterOutput, getHyperlinkProducer, getJasperReportsContext, getLocale, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getPageRange, getParameter, getParameters, getPropertiesUtil, getRendererUtil, getReportContext, getStyledText, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, insideFrame, reset, resetClassLoader, resetExportContext, restoreElementOffsets, setClassLoader, setConfiguration, setConfiguration, setCurrentExporterInputItem, setExporterInput, setExporterOutput, setFrameElementsOffset, setJasperPrint, setJasperReportsContext, setOffset, setOffset, setParameter, setParameters, setReportContextpublic static final String EXCEPTION_MESSAGE_KEY_INVALID_TEXT_HEIGHT
public static final String PROPERTY_IGNORE_HYPERLINK
RtfReportConfiguration.PROPERTY_IGNORE_HYPERLINK.public static final String RTF_EXPORTER_KEY
GenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String).protected static final String JR_PAGE_ANCHOR_PREFIX
protected FileBufferedWriter colorWriter
protected FileBufferedWriter fontWriter
protected FileBufferedWriter contentWriter
protected File destFile
protected int reportIndex
protected RenderersCache renderersCache
public JRRtfExporter()
JRRtfExporter(JasperReportsContext)public JRRtfExporter(JasperReportsContext jasperReportsContext)
protected Class<RtfExporterConfiguration> getConfigurationInterface()
protected Class<RtfReportConfiguration> getItemConfigurationInterface()
protected void ensureOutput()
ensureOutput in class JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>public void exportReport()
throws JRException
ExporterexportReport in interface Exporter<ExporterInput,RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput>exportReport in class JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>JRExceptionprotected void initExport()
protected void initReport()
protected void exportReportToWriter(Writer writer) throws JRException, IOException
JRExceptionIOExceptionprotected void exportPage(JRPrintPage page, boolean lastPage) throws JRException, IOException
page - Page that will be exportedJRExceptionIOExceptionprotected void exportLine(JRPrintLine line) throws IOException
line - JasperReports line object - JRPrintLineIOExceptionprotected void exportRectangle(JRPrintRectangle rectangle) throws IOException
rectangle - JasperReports rectangle object (JRPrintRectangle)IOExceptionprotected void exportEllipse(JRPrintEllipse ellipse) throws IOException
ellipse - JasperReports ellipse object (JRPrintElipse)IOExceptionpublic void exportText(JRPrintText text) throws IOException, JRException
text - JasperReports text object (JRPrintText)JRExceptionIOExceptionpublic void exportImage(JRPrintImage printImage) throws JRException, IOException
printImage - JasperReports image object (JRPrintImage)JRExceptionIOExceptionpublic void exportFrame(JRPrintFrame frame) throws JRException, IOException
frame - JRExceptionIOExceptionprotected void exportElements(Collection<JRPrintElement> elements) throws JRException, IOException
JRExceptionIOExceptionprotected void exportGenericElement(JRGenericPrintElement element)
protected boolean exportHyperlink(JRPrintHyperlink link) throws IOException
IOExceptionprotected void writeShapeHyperlink(JRPrintHyperlink link) throws IOException
IOExceptionprotected void endHyperlink(boolean startedHyperlink)
throws IOException
IOExceptionprotected void writeAnchor(String anchorName) throws IOException
IOExceptionpublic String getExporterKey()
public String getExporterPropertiesPrefix()
JRAbstractExportergetExporterPropertiesPrefix in class JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>Copyright © 2017. All rights reserved.