Hi,
I am facing a problem when parsing a HTML string and adding it in a RTF
Table cell. I have the below sample strings. When I parse these and add them
in the a RTF TableCell, they appear as dotted lines .... (Text with size as
1). 

It can be viewed only if we increase the size. Is there a way to show these
string properly without loosing the formatings with proper size.

The HTML string contains the below string:

<p><s pan style="font-size: x-small">Sample Text1</s pan ></p>
<p><s pan style="font-size: larger">Sample Text2</s pan ></p>
<p><s pan style="font-size: xx-small">Sample Text3</s pan ></p>

I have attached a report which shows this. Also, attached the html file.
Kindly have a look.

Code:
private java.io.Reader notesReader = null;
String dataText = "<p><s pan style=\"font-size: x-small\">Sample Text1</p>"
+ "<p><s pan style=\"font-size: larger\">Sample Text2</p>"
+ "<p><s pan style=\"font-size: xx-small\">Sample Text3</p>";

Paragraph para = new Paragraph( "");  
Cell myCell = new Cell();
Table              mainTable                       = null;
ArrayList list = null;
Document                rtfReportDocument                 = new Document();
try {

mainTable = new Table(1);
                        mainTable.setWidth(100.0f);
                        mainTable.setWidths(80.0f);


java.io.File file = new File("d:/test/myfile.rtf");
RtfWriter2 writer2 = RtfWriter2.getInstance(rtfReportDocument, new
FileOutputStream(file));

notesReader = new StringReader(dataText);
list = HTMLWorker.parseToList( notesReader, null );
} catch (Exception parseExpection) {
}
for( int i = 0; i < list.size(  ); i++ ) {
        para.add( (Element)list.get( i ) );
        
}
mycell.addPara(para);
mainTable.addCell(mycell);
rtfReportDocument.add(mainTable);

rtfReportDocument.close();
http://www.nabble.com/file/p21362426/sample%2Brtf.rtf sample+rtf.rtf 
http://www.nabble.com/file/p21362426/sampel%2Bhtml.html sampel+html.html 
-- 
View this message in context: 
http://www.nabble.com/Trouble-rendering-HTML-strings-with-%22font-size%3A-small%22-tp21362426p21362426.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source.
http://p.sf.net/sfu/Xq1LFB
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php

Reply via email to