public void write(RtfWriter writer,
OutputStream out) throws IOException {
writer.writeInitialFontSignature( out, this );
out.write( RtfWriter.filterSpecialChar( content(), true ).getBytes() );
writer.writeFinishingFontSignature( out, this );
if (addTOCAsTOCEntry) {
RtfTOCEntry entry = new RtfTOCEntry( entryName, entryFont );
entry.hideText();
try {
writer.add( entry );
} catch ( DocumentException de ) {
throw new ExceptionConverter(de);
}
}
// line break after headline
out.write( RtfWriter.escape );
out.write( RtfWriter.paragraph );
out.write( RtfWriter.delimiter );
// toc field entry
out.write( RtfWriter.openGroup );
out.write( RtfWriter.escape );
out.write( RtfWriter.field );
// field initialization stuff
out.write( RtfWriter.openGroup );
out.write( RtfWriter.escape );
out.write( RtfWriter.fieldContent );
out.write( RtfWriter.delimiter );
out.write( "TOC".getBytes() );
// create the TOC based on the 'toc entries'
out.write( RtfWriter.delimiter );
out.write( RtfWriter.escape );
out.write( RtfWriter.escape );
out.write( "f".getBytes() );
out.write( RtfWriter.delimiter );
// create Hyperlink TOC Entrie
out.write( RtfWriter.escape );
out.write( RtfWriter.escape );
out.write( "h".getBytes() );
out.write( RtfWriter.delimiter );
// create the TOC based on the paragraph level
out.write( RtfWriter.delimiter );
out.write( RtfWriter.escape );
out.write( RtfWriter.escape );
out.write( "u".getBytes() );
out.write( RtfWriter.delimiter );
// create the TOC based on the paragraph headlines 1-5
out.write( RtfWriter.delimiter );
out.write( RtfWriter.escape );
out.write( RtfWriter.escape );
out.write( "o".getBytes() );
out.write( RtfWriter.delimiter );
out.write( "\"1-5\"".getBytes() );
out.write( RtfWriter.delimiter );
out.write( RtfWriter.closeGroup );
// field default result stuff
out.write( RtfWriter.openGroup );
out.write( RtfWriter.escape );
out.write( RtfWriter.fieldDisplay );
out.write( RtfWriter.delimiter );
out.write( defaultText.getBytes() );
out.write( RtfWriter.delimiter );
out.write( RtfWriter.closeGroup );
out.write( RtfWriter.closeGroup );
}
|