Hi. I'm playing with RtfTOCEntry and I want to generate an index like this:
1. TOC1
1.1 TOC 2
1.2 Toc 3
1.2.1 TOC 4
1.2.2 TOC 5
1.3 Toc 6
1.3.1 TOC 7
First problem: If I add an entry like "1\tTOC1" or "1.1\tTOC" they have
different tab settings. I think there should be a default setting for the tabs
in the toc.
Second problem: In the fist line "1.\tTOC1" an tab is possible, but not in the
beginning of a line, e.g "\t1.1" or "\t\t1.1.1".
And the font is not properly set -- but I read about this problem in the
newsgroup.
Thanks,
Christian
-----
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.Font;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.rtf.RtfWriter2;
import com.lowagie.text.rtf.field.RtfTOCEntry;
import com.lowagie.text.rtf.field.RtfTableOfContents;
public class RtfWriterExample
{
public static void main( String[] args ) throws Exception
{
Document doc = new Document( PageSize.A4 );
RtfWriter2 writer = RtfWriter2.getInstance( doc, new FileOutputStream(
"c:/sample.rtf" ) );
doc.open();
Paragraph para = new Paragraph();
para.add( new RtfTableOfContents(
"Zum Update bitte im Kontextmenü 'Felder aktualieren' auswählen.",
new Font() ) );
doc.add( para );
Font fontBold = new Font( Font.HELVETICA, Font.DEFAULTSIZE, Font.BOLD );
Font font = new Font( Font.HELVETICA );
RtfTOCEntry tocEntry = new RtfTOCEntry( "1\tÜberschrift 1", fontBold );
doc.add( tocEntry );
RtfTOCEntry tocEntry2 = new RtfTOCEntry( "\t1.1\tÜberschrift 1.1", font );
doc.add( tocEntry2 );
RtfTOCEntry tocEntry3 = new RtfTOCEntry( "\t\t1.1.1\tÜberschrift 1.1.1",
font );
doc.add( tocEntry3 );
doc.close();
}
}
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions