I need to copy an HTML table and write it into a word doc. A sample of my HTML is
<table id="intimation" runat="server">
<tr>
<td>
test page
</td>
<td>
new test
</td>
</tr>
<tr>
<td>
test page
开发者_高级运维</td>
<td>
new test
</td>
</tr>
</table>
I need to copy this table into a string .. then i can esily insert it into the word doc
Html Agility Pack seems to be what you need. Take a look at its documentation.
you can use the StreamWriter
to write and if you want to store HTML
in string
type variable, you can achieve it as following:
string TestHTML = "<table id=\"intimation\" runat=\"server\">";
if you put the backslash (\
) infront of double quotes ("
), it will allow you to store the double quotes in string variable. But backslash (\
) will not appear in written file.
string TestHTML = "<table id=\"intimation\" runat=\"server\">" +
"<tr><td>test page</td><td>new test</td></tr>" +
"<tr><td>test page</td>" +
"<td>new test</td></tr>" +
"</table>";
精彩评论