1 52 53 package com.lowagie.text.rtf.field; 54 55 import java.io.*; 56 57 import com.lowagie.text.Font; 58 59 60 61 72 public class RtfTableOfContents extends RtfField { 73 74 77 private final static String FIELD_INST = "TOC \\\\f \\\\h \\\\u \\\\o \"1-5\" "; 78 81 private String defaultText = "Table of Contents - Click to update"; 82 83 89 public RtfTableOfContents(String defaultText) { 90 super(null, new Font()); 91 this.defaultText = defaultText; 92 } 93 94 101 protected byte[] writeFieldInstContent() throws IOException 102 { 103 return FIELD_INST.getBytes(); 104 } 105 108 protected void writeFieldInstContent(final OutputStream out) throws IOException 109 { 110 out.write(FIELD_INST.getBytes()); 111 } 112 113 120 protected byte[] writeFieldResultContent() throws IOException 121 { 122 ByteArrayOutputStream out = new ByteArrayOutputStream(); 123 writeFieldResultContent(out); 124 return out.toByteArray(); 125 } 126 129 protected void writeFieldResultContent(final OutputStream out) throws IOException 130 { 131 document.filterSpecialChar(out, defaultText, true, true); 132 } 135 136 141 } 142 | Popular Tags |