Class PatchRtfWriter2
- java.lang.Object
-
- com.lowagie.text.DocWriter
-
- org.pentaho.reporting.engine.classic.core.modules.output.table.rtf.itext.PatchRtfWriter2
-
- All Implemented Interfaces:
com.lowagie.text.DocListener
,com.lowagie.text.ElementListener
,EventListener
public class PatchRtfWriter2 extends com.lowagie.text.DocWriter
The RtfWriter allows the creation of rtf documents via the iText system Version: $Id: PatchRtfWriter2.java 3583 2008-08-12 00:00:09Z xlv $- Author:
- Mark Hall (Mark.Hall@mail.room3b.eu)
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PatchRtfWriter2(com.lowagie.text.Document doc, OutputStream os)
Constructs a new RtfWriter that listens to the specified Document and writes its output to the OutputStream.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(com.lowagie.text.Element element)
Adds an Element to the Documentvoid
clearTextWrap()
This method is not supported in the RtfWritervoid
close()
Closes the RtfDocument.com.lowagie.text.rtf.document.RtfDocumentSettings
getDocumentSettings()
Gets the RtfDocumentSettings that specify how the rtf document is generated.static PatchRtfWriter2
getInstance(com.lowagie.text.Document doc, OutputStream os)
Static method to generate RtfWritersvoid
importRtfDocument(FileInputStream documentSource)
Adds the complete RTF document to the current RTF document being generated.void
importRtfDocument(InputStream documentSource, EventListener[] events)
Adds the complete RTF document to the current RTF document being generated.void
importRtfDocumentIntoElement(com.lowagie.text.Element elem, FileInputStream documentSource)
Adds the complete RTF document to the current RTF element being generated.void
importRtfDocumentIntoElement(com.lowagie.text.Element elem, FileInputStream documentSource, EventListener[] events)
Adds the complete RTF document to the current RTF element being generated.void
importRtfFragment(InputStream documentSource, com.lowagie.text.rtf.parser.RtfImportMappings mappings)
Adds a fragment of an RTF document to the current RTF document being generated.void
importRtfFragment(InputStream documentSource, com.lowagie.text.rtf.parser.RtfImportMappings mappings, EventListener[] events)
Adds a fragment of an RTF document to the current RTF document being generated.boolean
newPage()
Adds a page breakvoid
open()
Opens the RtfDocumentvoid
resetFooter()
Resets the footervoid
resetHeader()
Resets the headervoid
resetPageCount()
This method is not supported in the RtfWritervoid
setAutogenerateTOCEntries(boolean autogenerate)
Whether to automagically generate table of contents entries when adding Chapters or Sections.void
setFooter(com.lowagie.text.HeaderFooter hf)
Sets the footer to usevoid
setHeader(com.lowagie.text.HeaderFooter hf)
Sets the header to useboolean
setMargins(float left, float right, float top, float bottom)
Sets the page marginsvoid
setPageCount(int i)
This method is not supported in the RtfWriterboolean
setPageSize(com.lowagie.text.Rectangle rect)
Sets the size of the page
-
-
-
Constructor Detail
-
PatchRtfWriter2
protected PatchRtfWriter2(com.lowagie.text.Document doc, OutputStream os)
Constructs a new RtfWriter that listens to the specified Document and writes its output to the OutputStream.- Parameters:
doc
- The Document that this RtfWriter listens toos
- The OutputStream to write to
-
-
Method Detail
-
getInstance
public static PatchRtfWriter2 getInstance(com.lowagie.text.Document doc, OutputStream os)
Static method to generate RtfWriters- Parameters:
doc
- The Document that this RtfWriter listens toos
- The OutputStream to write to- Returns:
- The new RtfWriter
-
setHeader
public void setHeader(com.lowagie.text.HeaderFooter hf)
Sets the header to use- Specified by:
setHeader
in interfacecom.lowagie.text.DocListener
- Overrides:
setHeader
in classcom.lowagie.text.DocWriter
- Parameters:
hf
- The HeaderFooter to use
-
resetHeader
public void resetHeader()
Resets the header- Specified by:
resetHeader
in interfacecom.lowagie.text.DocListener
- Overrides:
resetHeader
in classcom.lowagie.text.DocWriter
-
setFooter
public void setFooter(com.lowagie.text.HeaderFooter hf)
Sets the footer to use- Specified by:
setFooter
in interfacecom.lowagie.text.DocListener
- Overrides:
setFooter
in classcom.lowagie.text.DocWriter
- Parameters:
hf
- The HeaderFooter to use
-
resetFooter
public void resetFooter()
Resets the footer- Specified by:
resetFooter
in interfacecom.lowagie.text.DocListener
- Overrides:
resetFooter
in classcom.lowagie.text.DocWriter
-
setPageCount
public void setPageCount(int i)
This method is not supported in the RtfWriter- Specified by:
setPageCount
in interfacecom.lowagie.text.DocListener
- Overrides:
setPageCount
in classcom.lowagie.text.DocWriter
- Parameters:
i
- Unused
-
resetPageCount
public void resetPageCount()
This method is not supported in the RtfWriter- Specified by:
resetPageCount
in interfacecom.lowagie.text.DocListener
- Overrides:
resetPageCount
in classcom.lowagie.text.DocWriter
-
clearTextWrap
public void clearTextWrap()
This method is not supported in the RtfWriter
-
open
public void open()
Opens the RtfDocument- Specified by:
open
in interfacecom.lowagie.text.DocListener
- Overrides:
open
in classcom.lowagie.text.DocWriter
-
close
public void close()
Closes the RtfDocument. This causes the document to be written to the specified OutputStream- Specified by:
close
in interfacecom.lowagie.text.DocListener
- Overrides:
close
in classcom.lowagie.text.DocWriter
-
add
public boolean add(com.lowagie.text.Element element) throws com.lowagie.text.DocumentException
Adds an Element to the Document- Specified by:
add
in interfacecom.lowagie.text.ElementListener
- Overrides:
add
in classcom.lowagie.text.DocWriter
- Parameters:
element
- The element to be added- Returns:
false
- Throws:
com.lowagie.text.DocumentException
-
newPage
public boolean newPage()
Adds a page break- Specified by:
newPage
in interfacecom.lowagie.text.DocListener
- Overrides:
newPage
in classcom.lowagie.text.DocWriter
- Returns:
false
-
setMargins
public boolean setMargins(float left, float right, float top, float bottom)
Sets the page margins- Specified by:
setMargins
in interfacecom.lowagie.text.DocListener
- Overrides:
setMargins
in classcom.lowagie.text.DocWriter
- Parameters:
left
- The left marginright
- The right margintop
- The top marginbottom
- The bottom margin- Returns:
false
-
setPageSize
public boolean setPageSize(com.lowagie.text.Rectangle rect)
Sets the size of the page- Specified by:
setPageSize
in interfacecom.lowagie.text.DocListener
- Overrides:
setPageSize
in classcom.lowagie.text.DocWriter
- Parameters:
rect
- A Rectangle representing the page- Returns:
false
-
setAutogenerateTOCEntries
public void setAutogenerateTOCEntries(boolean autogenerate)
Whether to automagically generate table of contents entries when adding Chapters or Sections.- Parameters:
autogenerate
- Whether to automatically generate TOC entries
-
getDocumentSettings
public com.lowagie.text.rtf.document.RtfDocumentSettings getDocumentSettings()
Gets the RtfDocumentSettings that specify how the rtf document is generated.- Returns:
- The current RtfDocumentSettings.
-
importRtfDocument
public void importRtfDocument(FileInputStream documentSource) throws IOException, com.lowagie.text.DocumentException
Adds the complete RTF document to the current RTF document being generated. It will parse the font and color tables and correct the font and color references so that the imported RTF document retains its formattings.- Parameters:
documentSource
- The Reader to read the RTF document from.- Throws:
IOException
- On errors reading the RTF document.com.lowagie.text.DocumentException
- On errors adding to this RTF document.- Since:
- 2.1.0
-
importRtfDocument
public void importRtfDocument(InputStream documentSource, EventListener[] events) throws IOException, com.lowagie.text.DocumentException
Adds the complete RTF document to the current RTF document being generated. It will parse the font and color tables and correct the font and color references so that the imported RTF document retains its formattings. Uses new RtfParser object. (author: Howard Shank)- Parameters:
documentSource
- The InputStream to read the RTF document from.events
- The array of event listeners. May be null- Throws:
IOException
com.lowagie.text.DocumentException
- Since:
- 2.0.8
- See Also:
RtfParser
,RtfParser.importRtfDocument(InputStream, com.lowagie.text.rtf.document.RtfDocument)
-
importRtfFragment
public void importRtfFragment(InputStream documentSource, com.lowagie.text.rtf.parser.RtfImportMappings mappings) throws IOException, com.lowagie.text.DocumentException
Adds a fragment of an RTF document to the current RTF document being generated. Since this fragment doesn't contain font or color tables, all fonts and colors are mapped to the default font and color. If the font and color mappings are known, they can be specified via the mappings parameter.- Parameters:
documentSource
- The InputStream to read the RTF fragment from.mappings
- The RtfImportMappings that contain font and color mappings to apply to the fragment.- Throws:
IOException
- On errors reading the RTF fragment.com.lowagie.text.DocumentException
- On errors adding to this RTF fragment.- Since:
- 2.1.0
-
importRtfFragment
public void importRtfFragment(InputStream documentSource, com.lowagie.text.rtf.parser.RtfImportMappings mappings, EventListener[] events) throws IOException, com.lowagie.text.DocumentException
Adds a fragment of an RTF document to the current RTF document being generated. Since this fragment doesn't contain font or color tables, all fonts and colors are mapped to the default font and color. If the font and color mappings are known, they can be specified via the mappings parameter. Uses new RtfParser object. (author: Howard Shank)- Parameters:
documentSource
- The InputStream to read the RTF fragment from.mappings
- The RtfImportMappings that contain font and color mappings to apply to the fragment.events
- The array of event listeners. May be null- Throws:
IOException
- On errors reading the RTF fragment.com.lowagie.text.DocumentException
- On errors adding to this RTF fragment.- Since:
- 2.0.8
- See Also:
RtfImportMappings
,RtfParser
,RtfParser.importRtfFragment(InputStream, com.lowagie.text.rtf.document.RtfDocument, RtfImportMappings)
-
importRtfDocumentIntoElement
public void importRtfDocumentIntoElement(com.lowagie.text.Element elem, FileInputStream documentSource) throws IOException, com.lowagie.text.DocumentException
Adds the complete RTF document to the current RTF element being generated. It will parse the font and color tables and correct the font and color references so that the imported RTF document retains its formattings.- Parameters:
elem
- The Element the RTF document is to be imported into.documentSource
- The Reader to read the RTF document from.- Throws:
IOException
- On errors reading the RTF document.com.lowagie.text.DocumentException
- On errors adding to this RTF document.- Since:
- 2.1.4
-
importRtfDocumentIntoElement
public void importRtfDocumentIntoElement(com.lowagie.text.Element elem, FileInputStream documentSource, EventListener[] events) throws IOException, com.lowagie.text.DocumentException
Adds the complete RTF document to the current RTF element being generated. It will parse the font and color tables and correct the font and color references so that the imported RTF document retains its formattings.- Parameters:
elem
- The Element the RTF document is to be imported into.documentSource
- The Reader to read the RTF document from.events
- The event array for listeners.- Throws:
IOException
- On errors reading the RTF document.com.lowagie.text.DocumentException
- On errors adding to this RTF document.- Since:
- 2.1.4
-
-