我想用iTextSharp将一个html页面导出为pdf。我有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 :(得分: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'>");