Tutorials/Spire.Doc/Spire.Doc-Program-Guide/How-to-Replace-Text-in-a-Word-Template-with-HTML.html
only difference is that I have replaced this
- Code: Select all
p4.AppendHTML("<p style='text-align: Right'><span style='background-color: yellow'><i><b>here is the topic text for Governing Body Oversight</b></i></span></p><p style='text-align: left'><span style='background-color: yellow'><i><b> fdsafds</b></i></span></p>")
with this
- Code: Select all
Dim sWriter As New StringWriter()
Dim hWriter As New HtmlTextWriter(sWriter)
Dim GridView1 As New GridView()
GridView1.DataSource = DataSetAuswertung.Tables(0)
GridView1.DataBind()
GridView1.RenderControl(hWriter)
Dim controlHtml As String = sWriter.ToString()
p4.AppendHTML(controlHtml)
It works when I output some other HTML text, like the one in the example.
controlHTML is an HTML table and it has correct structure. This is table's HTML
- Code: Select all
<div>
<table cellspacing="0" rules="all" border="1" style="border-collapse:collapse;">
<tr>
<th scope="col">Klinik</th><th scope="col">Jahr</th><th scope="col">Code</th><th scope="col">Anzahl</th><th scope="col">Prozent</th><th scope="col">Prioritaet</th>
</tr><tr>
<td>*</td><td>*</td><td> </td><td>2</td><td>0</td><td> </td>
</tr><tr>
<td>*</td><td>*</td><td>1</td><td>6</td><td>0</td><td> </td>
</tr><tr>
<td>*</td><td>*</td><td>2</td><td>83</td><td>0</td><td> </td>
</tr><tr>
<td>*</td><td>*</td><td>3</td><td>178</td><td>0</td><td> </td>
</tr><tr>
<td>*</td><td>*</td><td>4</td><td>230</td><td>0</td><td> </td>
</tr><tr>
<td>*</td><td>*</td><td>5</td><td>265</td><td>0</td><td> </td>
</tr><tr>
<td>*</td><td>*</td><td>6</td><td>299</td><td>0</td><td> </td>
</tr><tr>
<td>*</td><td>*</td><td>7</td><td>287</td><td>0</td><td> </td>
</tr><tr>
<td>*</td><td>*</td><td>8</td><td>271</td><td>0</td><td> </td>
</tr><tr>
<td>*</td><td>*</td><td>9</td><td>251</td><td>0</td><td> </td>
</tr><tr>
<td>*</td><td>*</td><td>10</td><td>42</td><td>0</td><td> </td>
</tr><tr>
<td>*</td><td>*</td><td>11</td><td>1</td><td>0</td><td> </td>
</tr>
</table>
</div>