Question about rtf and stylesheets
- From: Jukka Pitkänen <ltn-jukka (at) suomi24.fi>
- Date: Thu, 18 May 2006 11:43:53 +0200 (CEST)
Hello!
I use the iText 1.4 to create rft-documents. In the iText 1.4 there
are classes RtfParagraphStyle and RtfStylesheet, I thought that the
RtfParagraphStyle can be used like the RtfFont but in a way that the
stylesheet information is saved to the generated document. So question
is how to save this information?
Code below doesn't do that and I think I missed some point about
saving the stylesheet information to the document, obviously ;)
Thanks a lot of in advance, Jukka
/*********************************************************/
Document doc = new Document(PageSize.A4);
RtfWriter2 writer2 = RtfWriter2.getInstance(doc,new
FileOutputStream("TESTI.rtf"));
RtfParagraphStyle head=new RtfParagraphStyle("Head", "Arial", 8,
RtfFont.BOLD,Color.black);
RtfParagraphStyle head2=new RtfParagraphStyle("Head2", "Arial", 8,
RtfFont.ITALIC,Color.black);
RtfParagraphStyle teksti=new RtfParagraphStyle("Teksti", "Arial",
8, Font.NORMAL,Color.black);
When I first used the RtfParagraphStyle the font size and style didn't
work correctly, so I set the font size and style for each of style. (MS
Word showed that font size is 1638 and no formatting).
Float k = new Float(8);
head.setSize(k);
head.setStyle(Font.BOLD);
head2.setSize(k);
head2.setStyle(Font.ITALIC);
teksti.setSize(k);
teksti.setStyle(Font.NORMAL);
String otsikko = new String ("Bold headline\n");
String otsikko2 = new String ("Italic headline\n");
String sisalto = new String ("Something normal text.");
doc.add(new Paragraph(otsikko,head));
doc.add(new Paragraph(otsikko2,head2));
doc.add(new Paragraph(sisalto,teksti));
doc.close();
/*********************************************************/
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions (at) lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions