我的主要目的是使用VB.net在pdf中用蓝色标记某些单词。代码如下所示:
strSignHTML.Append("<TD class=""TBLDATA"" width=""25%"" align=left><br /><br>")
strSignHTML.Append("<hr color=""midnightblue"">")
strSignHTML.Append("</TD>")
strSignHTML.Append("<td width=50%> </td>")
strSignHTML.Append("<td class=""TBLDATA"" width=""25%"" align=left> <br>")
strSignHTML.Append("<hr color=""midnightblue"">")
strSignHTML.Append("</td>")
strSignHTML.Append("</tr>")
strSignHTML.Append("<tr>")
strSignHTML.Append("<td class=""TBLDATA"">")
strSignHTML.Append("<font color=""midnightblue""><b>Signature</b></font>")
strSignHTML.Append("</td>")
strSignHTML.Append("<td width=50%> </td>")
strSignHTML.Append("<td class=""TBLDATA"">")
strSignHTML.Append("<font color=""midnightblue""><b>Date</b></font>")
strSignHTML.Append("</td>")
strSignHTML.Append("</tr>")
strSignHTML.Append("<tr>")
答案 0 :(得分:0)
导入库后
Imports System.Text
实际上将strSignHTML
设置为StringBuilder
很好
Dim strSignHTML As New StringBuilder
strSignHTML.Append("<TD class=""TBLDATA"" width=""25%"" align=left><br /><br>")
strSignHTML.Append("<hr color=""midnightblue"">")
strSignHTML.Append("</TD>")
strSignHTML.Append("<td width=50%> </td>")
strSignHTML.Append("<td class=""TBLDATA"" width=""25%"" align=left> <br>")
strSignHTML.Append("<hr color=""midnightblue"">")
strSignHTML.Append("</td>")
strSignHTML.Append("</tr>")
strSignHTML.Append("<tr>")
strSignHTML.Append("<td class=""TBLDATA"">")
strSignHTML.Append("<font color=""midnightblue""><b>Signature</b></font>")
strSignHTML.Append("</td>")
strSignHTML.Append("<td width=50%> </td>")
strSignHTML.Append("<td class=""TBLDATA"">")
strSignHTML.Append("<font color=""midnightblue""><b>Date</b></font>")
strSignHTML.Append("</td>")
strSignHTML.Append("</tr>")
strSignHTML.Append("<tr>")
Dim myString As String = strSignHTML.ToString
即使如此,我还是更愿意使用CDATA
Dim myString As String = <![CDATA[
<TD class="TBLDATA" width="25%" align=left><br /><br>
<hr color="midnightblue">
</TD>
<td width=50%> </td>
<td class="TBLDATA" width="25%" align=left> <br>
<hr color="midnightblue">
</td>
</tr>
<tr>
<td class="TBLDATA">
<font color = "midnightblue"><b>Signature</b></font>
</td>
<td width = 50% >& nbsp;</td>
<td class="TBLDATA">
<font color = "midnightblue"><b>Date</b></font>
</td>
</tr>
<tr>]]>.Value