net.sf.jasperreports.engine.export
Class JRRtfExporter

java.lang.Object
  extended by net.sf.jasperreports.engine.JRAbstractExporter
      extended by net.sf.jasperreports.engine.export.JRRtfExporter
All Implemented Interfaces:
JRExporter

public class JRRtfExporter
extends JRAbstractExporter

Exports a JasperReports document to RTF format. It has binary output type and exports the document to a free-form layout. It uses the RTF Specification 1.6 (compatible with MS Word 6.0, 2003 and XP).

Since classic AWT fonts can be sometimes very different from system fonts (which are used by RTF viewers), a font mapping feature was added. By using the JRExporterParameter.FONT_MAP parameter, a logical font like "sansserif" can be mapped to a system specific font, like "Comic Sans MS". Both map keys and values are strings.

Version:
$Id: JRRtfExporter.java 2055 2008-01-11 11:55:58Z teodord $
Author:
Flavius Sana (flavius_sana@users.sourceforge.net)

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.jasperreports.engine.JRAbstractExporter
JRAbstractExporter.ParameterOverriddenResolver, JRAbstractExporter.ParameterOverrideResolver, JRAbstractExporter.ParameterResolver
 
Field Summary
protected  java.util.List colors
           
protected  java.io.File destFile
           
protected  java.util.List fonts
           
protected  JRHyperlinkProducerFactory hyperlinkProducerFactory
           
protected static java.lang.String JR_PAGE_ANCHOR_PREFIX
           
protected  JRExportProgressMonitor progressMonitor
           
protected  int reportIndex
           
protected  java.io.Writer writer
           
 
Fields inherited from class net.sf.jasperreports.engine.JRAbstractExporter
classLoader, classLoaderSet, dateFormatCache, endPageIndex, fileResolver, fileResolverSet, filter, globalOffsetX, globalOffsetY, isModeBatch, jasperPrint, jasperPrintList, numberFormatCache, parameters, startPageIndex, urlHandlerFactory, urlHandlerFactorySet
 
Constructor Summary
JRRtfExporter()
           
 
Method Summary
protected  void createColorAndFontEntries()
          Create color and font entries for the header of .rtf file.
protected  void exportElements(java.util.Collection elements)
           
protected  void exportEllipse(JRPrintEllipse ellipse)
          Draw a ellipse object
protected  void exportFrame(JRPrintFrame frame)
           
protected  void exportHyperlink(JRPrintHyperlink link)
           
protected  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  java.lang.StringBuffer exportReportToBuffer()
          Export report in .rtf format
protected  void exportReportToFile()
          Export report to a file in the .rtf format
protected  void exportReportToStream()
          Export report in .rtf format to a stream
protected  void exportText(JRPrintText text)
          Draw a text box
protected  JRHyperlinkProducer getCustomHandler(JRPrintHyperlink link)
           
protected  void setHyperlinkProducerFactory()
           
protected  void writeAnchor(java.lang.String anchorName)
           
 
Methods inherited from class net.sf.jasperreports.engine.JRAbstractExporter
defaultParseNumber, getBooleanCellValue, getBooleanParameter, getDateCellValue, getDateFormat, getIntegerParameter, getNumberCellValue, getNumberFormat, getOffsetX, getOffsetY, getParameter, getParameterResolver, getParameters, getStringParameter, getStringParameterOrDefault, getStyledText, getStyledText, getTextFormatFactoryClass, getTextLocale, getTextTimeZone, getTextValue, getTextValueString, reset, resetClassLoader, resetExportContext, restoreElementOffsets, setClassLoader, setExportContext, setFrameElementsOffset, setInput, setOffset, setOffset, setOutput, setPageRange, setParameter, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JR_PAGE_ANCHOR_PREFIX

protected static final java.lang.String JR_PAGE_ANCHOR_PREFIX
See Also:
Constant Field Values

progressMonitor

protected JRExportProgressMonitor progressMonitor

writer

protected java.io.Writer writer

destFile

protected java.io.File destFile

reportIndex

protected int reportIndex

colors

protected java.util.List colors

fonts

protected java.util.List fonts

hyperlinkProducerFactory

protected JRHyperlinkProducerFactory hyperlinkProducerFactory
Constructor Detail

JRRtfExporter

public JRRtfExporter()
Method Detail

exportReport

public void exportReport()
                  throws JRException
Export report in .rtf format

Specified by:
exportReport in interface JRExporter
Specified by:
exportReport in class JRAbstractExporter
Throws:
JRException

setHyperlinkProducerFactory

protected void setHyperlinkProducerFactory()

exportReportToBuffer

protected java.lang.StringBuffer exportReportToBuffer()
                                               throws JRException
Export report in .rtf format

Returns:
report in .rtf format in a StringBuffer object
Throws:
JRException

exportReportToStream

protected void exportReportToStream()
                             throws JRException,
                                    java.io.IOException
Export report in .rtf format to a stream

Throws:
JRException
java.io.IOException

exportReportToFile

protected void exportReportToFile()
                           throws JRException
Export report to a file in the .rtf format

Throws:
JRException

createColorAndFontEntries

protected void createColorAndFontEntries()
                                  throws JRException
Create color and font entries for the header of .rtf file. Each color is represented by values of the red, green and blue components.

Throws:
JRException

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

protected 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

protected 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

protected void exportFrame(JRPrintFrame frame)
                    throws JRException,
                           java.io.IOException
Parameters:
frame -
Throws:
JRException
java.io.IOException

exportElements

protected void exportElements(java.util.Collection elements)
                       throws JRException,
                              java.io.IOException
Throws:
JRException
java.io.IOException

exportHyperlink

protected void exportHyperlink(JRPrintHyperlink link)
                        throws java.io.IOException
Throws:
java.io.IOException

getCustomHandler

protected JRHyperlinkProducer getCustomHandler(JRPrintHyperlink link)

writeAnchor

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


© 2001-2006 JasperSoft Corporation www.jaspersoft.com