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 FileBufferedWriterprotected FileBufferedWriterprotected Filestatic final Stringprotected FileBufferedWriterprotected static final Stringprotected RenderersCacheprotected intstatic final StringThe exporter key, as used inGenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String).static final StringFields 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 voidendHyperlink(boolean startedHyperlink) protected voidexportElements(Collection<JRPrintElement> elements) protected voidexportEllipse(JRPrintEllipse ellipse) Draw a ellipse objectvoidexportFrame(JRPrintFrame frame) protected voidprotected booleanvoidexportImage(JRPrintImage printImage) Export a image objectprotected voidexportLine(JRPrintLine line) Draw a line objectprotected voidexportPage(JRPrintPage page, boolean lastPage) Exports a report pageprotected voidexportRectangle(JRPrintRectangle rectangle) Draw a rectanglevoidPerforms the export.protected voidexportReportToWriter(Writer writer) Export report in .rtf format to a streamprotected voidexportStyledTextRun(Map<AttributedCharacterIterator.Attribute, Object> styledTextAttributes, String text, Locale locale, Color backcolor) voidexportText(JRPrintText text) Draw a text boxprotected Class<RtfExporterConfiguration> Returns the properties prefix for the current exporter.protected Class<RtfReportConfiguration> protected voidprotected voidprotected voidwriteAnchor(String anchorName) protected voidMethods 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:ExporterPerforms the export.- Specified by:
exportReportin interfaceExporter<ExporterInput,RtfReportConfiguration, RtfExporterConfiguration, WriterExporterOutput> - Specified by:
exportReportin 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:
JRExceptionIOException
-
exportPage
Exports a report page- Parameters:
page- Page that will be exported- Throws:
JRExceptionIOException
-
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:
JRExceptionIOException
-
exportStyledTextRun
protected void exportStyledTextRun(Map<AttributedCharacterIterator.Attribute, Object> styledTextAttributes, String text, Locale locale, Color backcolor) throws IOException, JRException- Throws:
IOExceptionJRException
-
exportImage
Export a image object- Parameters:
printImage- JasperReports image object (JRPrintImage)- Throws:
JRExceptionIOException
-
exportFrame
- Parameters:
frame-- Throws:
JRExceptionIOException
-
exportElements
- Throws:
JRExceptionIOException
-
exportGenericElement
-
exportHyperlink
- Throws:
IOException
-
writeShapeHyperlink
- Throws:
IOException
-
endHyperlink
- Throws:
IOException
-
writeAnchor
- Throws:
IOException
-
getExporterKey
-
getExporterPropertiesPrefix
Description copied from class:JRAbstractExporterReturns the properties prefix for the current exporter.- Specified by:
getExporterPropertiesPrefixin classJRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration, WriterExporterOutput, JRRtfExporterContext> - Returns:
- the properties prefix for the current exporter
-