尝试将 <hr> 标记放入 stringBuilderObject.Append() VB.net 时出现对象引用错误
Object Reference Error while trying to put <hr> tag in stringBuilderObject.Append() VB.net
我的主要目的是使用 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>")
导入库后
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
我的主要目的是使用 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>")
导入库后
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