2012-07-20 88 views
0
var htmlarraylist = HTMLWorker.ParseToList(new StringReader(htmlText), styles); 
document.Open(); 

BaseFont Vn_Helvetica = BaseFont.CreateFont(@"C:\Windows\Fonts\arial.ttf", 
"Identity-H", BaseFont.EMBEDDED); 
Font fontNormal = new Font(Vn_Helvetica, 12, Font.NORMAL); 


       foreach (var t in htmlarraylist) 
       { 
        if (t is PdfPTable) 
        {       
         //how set fontNormal all text from Pdfptable ? 
        } 

        document.Add((IElement)t); 

       } 

        document.Close(); 

有人可以幫我請從Pdfptable所有文本與iTextSharp的設置字體

+0

可能重複]((PdfPTable)t).DefaultCell.Phrase = new Phrase(){Font = fontNormal}(http://stackoverflow.com/questions/11562589/itextsharp-set-font-for-ielement) – 2012-07-20 13:42:39

回答

3

在你設置字體爲PdfPTable.DefaultCell property請嘗試foreach loop

Example: 
t.DefaultCell.Phrase = new Phrase() { Font = fontNormal }; 
的[iTextSharp的設置字體爲IElement
+0

我試過這種方式: ;但仍然不會出現變音符號( – Alex 2012-07-20 10:56:03

+0

@Alex是否適合您 – HatSoft 2012-07-20 10:57:02