Class JRRtfExporter
java.lang.Object
net.sf.jasperreports.engine.JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>
net.sf.jasperreports.engine.export.JRRtfExporter
- All Implemented Interfaces:
Exporter<ExporterInput,
RtfReportConfiguration, RtfExporterConfiguration, WriterExporterOutput>
public class JRRtfExporter
extends JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>
Exports a JasperReports document to RTF format.
The
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.- Author:
- Flavius Sana (flavius_sana@users.sourceforge.net)
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class net.sf.jasperreports.engine.JRAbstractExporter
JRAbstractExporter.BaseExporterContext, JRAbstractExporter.PageRange
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FileBufferedWriter
protected FileBufferedWriter
protected File
static final String
protected FileBufferedWriter
protected static final String
protected RenderersCache
protected int
static final String
The exporter key, as used inGenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String)
.static final String
Fields inherited from class net.sf.jasperreports.engine.JRAbstractExporter
allSelector, crtCompositeConfiguration, crtCompositeItemConfiguration, crtItem, dateFormatCache, EXCEPTION_MESSAGE_KEY_EMPTY_INPUT_SOURCE_IN_BATCH_MODE, EXCEPTION_MESSAGE_KEY_END_PAGE_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_INVALID_IMAGE_NAME, EXCEPTION_MESSAGE_KEY_INVALID_ZOOM_RATIO, EXCEPTION_MESSAGE_KEY_NO_INPUT_SOURCE, EXCEPTION_MESSAGE_KEY_NO_OUTPUT_SPECIFIED, 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, hyperlinkProducerFactory, itemConfiguration, jasperPrint, jasperReportsContext, noBackcolorSelector, noneSelector, numberFormatCache, propertiesUtil, PROPERTY_DEFAULT_FILTER_FACTORY, PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY, rendererUtil, styledTextUtil, textValueClasses
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
endHyperlink
(boolean startedHyperlink) protected void
exportElements
(Collection<JRPrintElement> elements) protected void
exportEllipse
(JRPrintEllipse ellipse) Draw a ellipse objectvoid
exportFrame
(JRPrintFrame frame) protected void
protected boolean
void
exportImage
(JRPrintImage printImage) Export a image objectprotected void
exportLine
(JRPrintLine line) Draw a line objectprotected void
exportPage
(JRPrintPage page, boolean lastPage) Exports a report pageprotected void
exportRectangle
(JRPrintRectangle rectangle) Draw a rectanglevoid
Performs the export.protected void
exportReportToWriter
(Writer writer) Export report in .rtf format to a streamprotected void
exportStyledTextRun
(Map<AttributedCharacterIterator.Attribute, Object> styledTextAttributes, String text, Locale locale, Color backcolor) void
exportText
(JRPrintText text) Draw a text boxprotected Class
<RtfExporterConfiguration> Returns the properties prefix for the current exporter.protected Class
<RtfReportConfiguration> protected void
protected void
protected void
writeAnchor
(String anchorName) protected void
Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter
checkInterrupted, createFilter, defaultParseNumber, ensureInput, ensureJasperReportsContext, ensureOutput, getBooleanCellValue, getCurrentConfiguration, getCurrentItemConfiguration, getCurrentJasperPrint, getDateCellValue, getDateFormat, getExporterConfiguration, getExporterContext, getExporterInput, getExporterOutput, getHyperlinkProducer, getJasperReportsContext, getLocale, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getPageRange, getPropertiesUtil, getRendererUtil, getReportContext, getReportExportConfiguration, getRepository, getStyledText, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, insideFrame, reset, resetExportContext, restoreElementOffsets, setConfiguration, setConfiguration, setCurrentExporterInputItem, setExporterInput, setExporterOutput, setFrameElementsOffset, setJasperReportsContext, setOffset, setOffset, setReportContext
-
Field Details
-
RTF_EXPORTER_PROPERTIES_PREFIX
- See Also:
-
EXCEPTION_MESSAGE_KEY_INVALID_TEXT_HEIGHT
- See Also:
-
RTF_EXPORTER_KEY
The exporter key, as used inGenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String)
.- See Also:
-
JR_PAGE_ANCHOR_PREFIX
- See Also:
-
colorWriter
-
fontWriter
-
contentWriter
-
destFile
-
reportIndex
protected int reportIndex -
colors
-
fonts
-
renderersCache
-
-
Constructor Details
-
JRRtfExporter
public JRRtfExporter()- See Also:
-
JRRtfExporter
-
-
Method Details
-
getConfigurationInterface
-
getItemConfigurationInterface
-
exportReport
Description copied from interface:Exporter
Performs the export.- Specified by:
exportReport
in interfaceExporter<ExporterInput,
RtfReportConfiguration, RtfExporterConfiguration, WriterExporterOutput> - Specified by:
exportReport
in classJRAbstractExporter<RtfReportConfiguration,
RtfExporterConfiguration, WriterExporterOutput, JRRtfExporterContext> - Throws:
JRException
-
initExport
protected void initExport() -
initReport
protected void initReport() -
exportReportToWriter
Export report in .rtf format to a stream- Throws:
JRException
IOException
-
exportPage
Exports a report page- Parameters:
page
- Page that will be exported- Throws:
JRException
IOException
-
exportLine
Draw a line object- Parameters:
line
- JasperReports line object - JRPrintLine- Throws:
IOException
-
exportRectangle
Draw a rectangle- Parameters:
rectangle
- JasperReports rectangle object (JRPrintRectangle)- Throws:
IOException
-
exportEllipse
Draw a ellipse object- Parameters:
ellipse
- JasperReports ellipse object (JRPrintElipse)- Throws:
IOException
-
exportText
Draw a text box- Parameters:
text
- JasperReports text object (JRPrintText)- Throws:
JRException
IOException
-
exportStyledTextRun
protected void exportStyledTextRun(Map<AttributedCharacterIterator.Attribute, Object> styledTextAttributes, String text, Locale locale, Color backcolor) throws IOException, JRException- Throws:
IOException
JRException
-
exportImage
Export a image object- Parameters:
printImage
- JasperReports image object (JRPrintImage)- Throws:
JRException
IOException
-
exportFrame
- Parameters:
frame
-- Throws:
JRException
IOException
-
exportElements
- Throws:
JRException
IOException
-
exportGenericElement
-
exportHyperlink
- Throws:
IOException
-
writeShapeHyperlink
- Throws:
IOException
-
endHyperlink
- Throws:
IOException
-
writeAnchor
- Throws:
IOException
-
getExporterKey
-
getExporterPropertiesPrefix
Description copied from class:JRAbstractExporter
Returns the properties prefix for the current exporter.- Specified by:
getExporterPropertiesPrefix
in classJRAbstractExporter<RtfReportConfiguration,
RtfExporterConfiguration, WriterExporterOutput, JRRtfExporterContext> - Returns:
- the properties prefix for the current exporter
-