2012-08-14 73 views
1

我想用iTextSharp將一個html頁面導出爲pdf。我有2個表,我希望把邊境第一個表而不是另一個iTextSharp:爲2個表設置不同的邊框尺寸

//my first tabe 
strHTMLContent.Append("<table width='100%'>"); 
strHTMLContent.Append("<tr>"); 
strHTMLContent.Append("<td>" text "</td>"); 
strHTMLContent.Append("<td>" text "</td>"); 
strHTMLContent.Append("<td>"); 

//the 2nd table that I don't want to have border 
strHTMLContent.Append("<table>"); 
strHTMLContent.Append("<tr><td>" row1 " </td></tr> "); 
strHTMLContent.Append("<tr><td> " row2" </td></tr> "); 
strHTMLContent.Append("<tr><td> " row3 " </td></tr> "); 
strHTMLContent.Append("</table >"); 
strHTMLContent.Append("</td>"); 
strHTMLContent.Append("</tr>"); 
strHTMLContent.Append("</table >"); 

//I use StyleSheet for set border size 
var st = new StyleSheet(); 
st.LoadTagStyle("table", "border", "1"); 

回答

0

也許有點晚,但還沒有 - 你不能改變邊框尺寸,只有是或否。太悲傷了,但這就是itextsharp。關於您的問題,您可以直接在html標籤上直接設置邊框並刪除LoadTagStyle調用:

//my first tabe 
strHTMLContent.Append("<table width='100%' border='1'>"); 

//the 2nd table that I don't want to have border 
strHTMLContent.Append("<table border='0'>");