I am having an issue with HTML when opening a current HTML file and replacing what I need to using a StringBuilder… Below is the bit of code I am using to do this…
'Lets replace the grid information!'
Dim sb As New StringBuilder()
sb.AppendLine(" <table>")
sb.AppendLine("<tr>")
' sb.AppendLine("<th>")
For Each column As DataGridViewColumn In DataGridView1.Columns
sb.AppendLine(" <th>" + column.HeaderText + "</th>")
Next
' sb.AppendLine("</th>")
sb.AppendLine(" </tr>")
sb.AppendLine("</table")
HTML.Replace("%TABLE%", sb.ToString)
Everything is working so far, only issue I am having is getting rid of the “<” by the customers name field… I know it is because of the replace; it is adding an extra one there. But if I take it out of the append line, my grid goes out of wack… Here is a screen shot of this…

Here is the source of the HTML file I am grabbing and then replacing what I need too…
<!doctype html>
<html>
<head>
<title>Invoice %Invoice%</title>
<link rel="stylesheet" href=%STYLE%>
<style type="text/css">
@import url("style.css");
</style>
</head>
<body>
<header>
<h1>Invoice %Invoice%</h1>
<address>
<p>%Business%</p>
</address>
<img src="file:///%Image%" alt="" align="right">
</header>
<article>
<h1> </h1>
<h1> </h1>
<h1> </h1>
<h1>Recipient</h1>
<address>
<p>%Company%</p>
<p>%Contact%</p>
<p>%Address%</p>
</address>
<table class="meta">
<tr>
<th><span>Invoice #</span></th>
<td><span>%Invoice%</span></td>
</tr>
<tr>
<th><span>Date</span></th>
<td><span>%Date%</span></td>
</tr>
<tr>
<th><span>Amount Paid</span></th>
<td><span id="prefix">$</span><span>0.00</span></td>
</tr>
<tr>
<th><span>Amount Due</span></th>
<td><span id="prefix">$</span><span>600.00</span></td>
</tr>
</table>
<%TABLE%> THIS IS WHERE I SEND THE TABLE TO!
</article>
<aside>
<h1> </h1>
<h1> </h1>
<h1><span>Additional Notes</span></h1>
<div contenteditable>
<p align ='center'>A finance charge of 1.5% will be made on unpaid balances after 30 days.</p>
</div>
</aside>
</body>
</html>
Thanks!
Assuming HTML is a string the replace function returns a string result, so you need:
And as per the answer from
pickypg you probably really need: