com.lowagie.text.rtf.document
public class RtfDocument extends RtfElement
Modifier and Type | Field and Description |
---|---|
private boolean |
autogenerateTOCEntries
Whether to automatically generate TOC entries for Chapters and Sections.
|
private RtfDataCache |
data
Stores the actual document data
|
private RtfDocumentHeader |
documentHeader
The RtfDocumentHeader that handles all document header methods
|
private RtfDocumentSettings |
documentSettings
The RtfDocumentSettings for this RtfDocument.
|
private static byte[] |
FSC_BACKSLASH |
private static byte[] |
FSC_HEX_PREFIX |
private static byte[] |
FSC_LINE |
private static byte[] |
FSC_NEWPAGE |
private static byte[] |
FSC_PAGE_PAR |
private static byte[] |
FSC_PAR |
private static byte[] |
FSC_TAB |
private static byte[] |
FSC_UNI_PREFIX |
private RtfBasicElement |
lastElementWritten
The last RtfBasicElement that was added directly to the RtfDocument.
|
private RtfMapper |
mapper
The RtfMapper to use in this RtfDocument
|
private ArrayList |
previousRandomInts
Stores integers that have been generated as unique random numbers
|
private static byte[] |
RTF_DOCUMENT
Constant for the Rtf document start
|
document, inHeader, inTable
CLOSE_GROUP, COMMA_DELIMITER, DELIMITER, OPEN_GROUP, TWIPS_FACTOR
Constructor and Description |
---|
RtfDocument()
The default constructor for a RtfDocument
|
Modifier and Type | Method and Description |
---|---|
void |
add(RtfBasicElement element)
Adds an element to the rtf document
|
void |
filterSpecialChar(OutputStream out,
String str,
boolean useHex,
boolean softLineBreaks)
Writes the given string to the given
OutputStream encoding the string characters. |
boolean |
getAutogenerateTOCEntries()
Get whether to automatically generate table of contents entries
|
RtfDocumentHeader |
getDocumentHeader()
Gets the RtfDocumentHeader of this RtfDocument
|
RtfDocumentSettings |
getDocumentSettings()
Gets the RtfDocumentSettings that specify how the rtf document is generated.
|
RtfBasicElement |
getLastElementWritten()
Gets the last RtfBasicElement that was directly added to the RtfDocument.
|
RtfMapper |
getMapper()
Gets the RtfMapper object of this RtfDocument
|
int |
getRandomInt()
Generates a random integer that is unique with respect to the document.
|
void |
open()
Opens the RtfDocument and initializes the data cache.
|
void |
outputDebugLinebreak(OutputStream result)
Helper method outputs linebreak in document if debugging is turned on.
|
void |
setAutogenerateTOCEntries(boolean autogenerate)
Whether to automagically generate table of contents entries when
adding Chapters or Sections.
|
private static boolean |
subMatch(String str,
int soff,
byte[] m)
Returns
true if m.length characters in str, starting at offset soff
match the bytes in the given array m. |
void |
writeContent(OutputStream out)
unused
|
void |
writeDocument(OutputStream out)
Writes the document
|
intToByteArray, isInTable, setInHeader, setInTable, setRtfDocument
private RtfDataCache data
private RtfMapper mapper
private RtfDocumentHeader documentHeader
private ArrayList previousRandomInts
private boolean autogenerateTOCEntries
private RtfDocumentSettings documentSettings
private RtfBasicElement lastElementWritten
private static final byte[] RTF_DOCUMENT
private static final byte[] FSC_LINE
private static final byte[] FSC_PAR
private static final byte[] FSC_TAB
private static final byte[] FSC_PAGE_PAR
private static final byte[] FSC_NEWPAGE
private static final byte[] FSC_BACKSLASH
private static final byte[] FSC_HEX_PREFIX
private static final byte[] FSC_UNI_PREFIX
public void writeContent(OutputStream out) throws IOException
writeContent
in interface RtfBasicElement
writeContent
in class RtfElement
out
- The OutputStream
to write the content toIOException
public void writeDocument(OutputStream out)
out
- The OutputStream
to write the RTF document to.public void open()
public void add(RtfBasicElement element)
element
- The element to addpublic RtfMapper getMapper()
public int getRandomInt()
public RtfDocumentHeader getDocumentHeader()
public void filterSpecialChar(OutputStream out, String str, boolean useHex, boolean softLineBreaks) throws IOException
OutputStream
encoding the string characters.out
- destination OutputStreamstr
- string to writeuseHex
- if true
hex encoding characters is preferred to unicode encoding if possiblesoftLineBreaks
- if true
return characters are written as soft line breaksIOException
private static boolean subMatch(String str, int soff, byte[] m)
true
if m.length characters in str, starting at offset soff
match the bytes in the given array m.str
- the string to search for a matchsoff
- the starting offset in strm
- the array to matchtrue
if there is matchpublic void setAutogenerateTOCEntries(boolean autogenerate)
autogenerate
- Whether to automatically generate TOC entriespublic boolean getAutogenerateTOCEntries()
public RtfDocumentSettings getDocumentSettings()
public RtfBasicElement getLastElementWritten()
public final void outputDebugLinebreak(OutputStream result) throws IOException
result
- the OutputStream to write the linebreak to.IOException