public void InsertTableFromHtml()
{
//ExStart
//ExId:InsertTableFromHtml
//ExSummary:Shows how to insert a table in a document from a string containing HTML tags.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert the table from HTML. Note that AutoFitSettings does not apply to tables
// inserted from HTML.
builder.InsertHtml("<table>" +
"<tr>" +
"<td>Row 1, Cell 1</td>" +
"<td>Row 1, Cell 2</td>" +
"</tr>" +
"<tr>" +
"<td>Row 2, Cell 2</td>" +
"<td>Row 2, Cell 2</td>" +
"</tr>" +
"</table>");
doc.Save(MyDir + @"\Artifacts\DocumentBuilder.InsertTableFromHtml.doc");
//ExEnd
// Verify the table was constructed properly.
Assert.AreEqual(1, doc.GetChildNodes(NodeType.Table, true).Count);
Assert.AreEqual(2, doc.GetChildNodes(NodeType.Row, true).Count);
Assert.AreEqual(4, doc.GetChildNodes(NodeType.Cell, true).Count);
}