net.sf.jasperreports.engine.export

## Class JRRtfExporter

- java.lang.Object
- - net.sf.jasperreports.engine.JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>
  - - net.sf.jasperreports.engine.export.JRRtfExporter

- All Implemented Interfaces:
    JRExporter<ExporterInput,RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput>, 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.
  Version:
    $Id: JRRtfExporter.java 7065 2014-04-29 12:48:15Z shertage $
  Author:
    Flavius Sana (flavius_sana@users.sourceforge.net)
  See Also:
    `RtfReportConfiguration`

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `JRRtfExporter.ExporterContext`

    - ### Nested classes/interfaces inherited from class net.sf.jasperreports.engine.JRAbstractExporter

      `JRAbstractExporter.BaseExporterContext, JRAbstractExporter.PageRange`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.List<java.awt.Color>` | `colors`
    `protected FileBufferedWriter` | `colorWriter`
    `protected FileBufferedWriter` | `contentWriter`
    `protected java.io.File` | `destFile`
    `protected java.util.List<java.lang.String>` | `fonts`
    `protected FileBufferedWriter` | `fontWriter`
    `protected static java.lang.String` | `JR_PAGE_ANCHOR_PREFIX`
    `static java.lang.String` | `PROPERTY_IGNORE_HYPERLINK` Deprecated. Replaced by `RtfReportConfiguration.PROPERTY_IGNORE_HYPERLINK`.
    `protected int` | `reportIndex`
    `static java.lang.String` | `RTF_EXPORTER_KEY` The exporter key, as used in `GenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String)`.

    - ### Fields inherited from class net.sf.jasperreports.engine.JRAbstractExporter

      `allSelector, crtCompositeConfiguration, crtCompositeItemConfiguration, crtItem, dateFormatCache, EXCEPTION_MESSAGE_KEY_END_PAGE_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_PAGE_INDEX_OUT_OF_RANGE, EXCEPTION_MESSAGE_KEY_START_PAGE_INDEX_OUT_OF_RANGE, exporterConfiguration, exporterContext, exporterInput, exporterOutput, filter, itemConfiguration, jasperPrint, jasperReportsContext, noBackcolorSelector, noneSelector, numberFormatCache, parameters, propertiesUtil, PROPERTY_DEFAULT_FILTER_FACTORY, PROPERTY_SUFFIX_DEFAULT_FILTER_FACTORY, styledTextUtil`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JRRtfExporter()`
    `JRRtfExporter(JasperReportsContext jasperReportsContext)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `endHyperlink(boolean startedHyperlink)`
    `protected void` | `ensureOutput()`
    `protected void` | `exportElements(java.util.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()` Export report in .rtf format
    `protected void` | `exportReportToWriter(java.io.Writer writer)` Export report in .rtf format to a stream
    `void` | `exportText(JRPrintText text)` Draw a text box
    `protected java.lang.Class<RtfExporterConfiguration>` | `getConfigurationInterface()`
    `java.lang.String` | `getExporterKey()`
    `java.lang.String` | `getExporterPropertiesPrefix()` Returns the properties prefix for the current exporter.
    `protected java.lang.Class<RtfReportConfiguration>` | `getItemConfigurationInterface()`
    `protected void` | `initExport()`
    `protected void` | `initReport()`
    `protected void` | `writeAnchor(java.lang.String anchorName)`
    `protected void` | `writeShapeHyperlink(JRPrintHyperlink link)`

    - ### Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter

      `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, getReportContext, getStyledText, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, reset, resetClassLoader, resetExportContext, restoreElementOffsets, setClassLoader, setConfiguration, setConfiguration, setCurrentExporterInputItem, setExporterInput, setExporterOutput, setFrameElementsOffset, setJasperPrint, setJasperReportsContext, setOffset, setOffset, setParameter, setParameters, setReportContext`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PROPERTY_IGNORE_HYPERLINK

          public static final java.lang.String PROPERTY_IGNORE_HYPERLINK

      Deprecated. Replaced by `RtfReportConfiguration.PROPERTY_IGNORE_HYPERLINK`.
      See Also:
        Constant Field Values

    - #### RTF_EXPORTER_KEY

          public static final java.lang.String RTF_EXPORTER_KEY

      The exporter key, as used in `GenericElementHandlerEnviroment.getElementHandler(JRGenericElementType, String)`.
      See Also:
        Constant Field Values

    - #### JR_PAGE_ANCHOR_PREFIX

          protected static final java.lang.String JR_PAGE_ANCHOR_PREFIX

      See Also:
        Constant Field Values

    - #### colorWriter

          protected FileBufferedWriter colorWriter

    - #### fontWriter

          protected FileBufferedWriter fontWriter

    - #### contentWriter

          protected FileBufferedWriter contentWriter

    - #### destFile

          protected java.io.File destFile

    - #### reportIndex

          protected int reportIndex

    - #### colors

          protected java.util.List<java.awt.Color> colors

    - #### fonts

          protected java.util.List<java.lang.String> fonts

  - ### Constructor Detail

    - #### JRRtfExporter

          public JRRtfExporter()

      See Also:
        `JRRtfExporter(JasperReportsContext)`

    - #### JRRtfExporter

          public JRRtfExporter(JasperReportsContext jasperReportsContext)

  - ### Method Detail

    - #### getConfigurationInterface

          protected java.lang.Class<RtfExporterConfiguration> getConfigurationInterface()

      Specified by:
        `getConfigurationInterface` in class `JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>`

    - #### getItemConfigurationInterface

          protected java.lang.Class<RtfReportConfiguration> getItemConfigurationInterface()

      Specified by:
        `getItemConfigurationInterface` in class `JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>`

    - #### ensureOutput

          protected void ensureOutput()

      Specified by:
        `ensureOutput` in class `JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>`

    - #### exportReport

          public void exportReport()
                            throws JRException

      Export report in .rtf format
      Specified by:
        `exportReport` in interface `Exporter<ExporterInput,RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput>`
      Specified by:
        `exportReport` in class `JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>`
      Throws:
        `JRException`

    - #### initExport

          protected void initExport()

      Overrides:
        `initExport` in class `JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>`

    - #### initReport

          protected void initReport()

      Overrides:
        `initReport` in class `JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>`

    - #### exportReportToWriter

          protected void exportReportToWriter(java.io.Writer writer)
                                       throws JRException,
                                              java.io.IOException

      Export report in .rtf format to a stream
      Throws:
        `JRException`
        `java.io.IOException`

    - #### exportPage

          protected void exportPage(JRPrintPage page,
                        boolean lastPage)
                             throws JRException,
                                    java.io.IOException

      Exports a report page
      Parameters:
        `page` - Page that will be exported
      Throws:
        `JRException`
        `java.io.IOException`

    - #### exportLine

          protected void exportLine(JRPrintLine line)
                             throws java.io.IOException

      Draw a line object
      Parameters:
        `line` - JasperReports line object - JRPrintLine
      Throws:
        `java.io.IOException`

    - #### exportRectangle

          protected void exportRectangle(JRPrintRectangle rectangle)
                                  throws java.io.IOException

      Draw a rectangle
      Parameters:
        `rectangle` - JasperReports rectangle object (JRPrintRectangle)
      Throws:
        `java.io.IOException`

    - #### exportEllipse

          protected void exportEllipse(JRPrintEllipse ellipse)
                                throws java.io.IOException

      Draw a ellipse object
      Parameters:
        `ellipse` - JasperReports ellipse object (JRPrintElipse)
      Throws:
        `java.io.IOException`

    - #### exportText

          public void exportText(JRPrintText text)
                          throws java.io.IOException,
                                 JRException

      Draw a text box
      Parameters:
        `text` - JasperReports text object (JRPrintText)
      Throws:
        `JRException`
        `java.io.IOException`

    - #### exportImage

          public void exportImage(JRPrintImage printImage)
                           throws JRException,
                                  java.io.IOException

      Export a image object
      Parameters:
        `printImage` - JasperReports image object (JRPrintImage)
      Throws:
        `JRException`
        `java.io.IOException`

    - #### exportFrame

          public void exportFrame(JRPrintFrame frame)
                           throws JRException,
                                  java.io.IOException

      Parameters:
        `frame` -
      Throws:
        `JRException`
        `java.io.IOException`

    - #### exportElements

          protected void exportElements(java.util.Collection<JRPrintElement> elements)
                                 throws JRException,
                                        java.io.IOException

      Throws:
        `JRException`
        `java.io.IOException`

    - #### exportGenericElement

          protected void exportGenericElement(JRGenericPrintElement element)

    - #### exportHyperlink

          protected boolean exportHyperlink(JRPrintHyperlink link)
                                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writeShapeHyperlink

          protected void writeShapeHyperlink(JRPrintHyperlink link)
                                      throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### endHyperlink

          protected void endHyperlink(boolean startedHyperlink)
                               throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writeAnchor

          protected void writeAnchor(java.lang.String anchorName)
                              throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getExporterKey

          public java.lang.String getExporterKey()

      Specified by:
        `getExporterKey` in class `JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>`

    - #### getExporterPropertiesPrefix

          public java.lang.String getExporterPropertiesPrefix()

      Description copied from class: `JRAbstractExporter`
      Returns the properties prefix for the current exporter.
      Specified by:
        `getExporterPropertiesPrefix` in class `JRAbstractExporter<RtfReportConfiguration,RtfExporterConfiguration,WriterExporterOutput,JRRtfExporterContext>`
      Returns:
        the properties prefix for the current exporter

© 2001-2010 Jaspersoft Corporation www.jaspersoft.com