<table>
How to add cells at run time?
IHTMLTable interface
This interface specifies that the contained content is organized into a table with rows and columns.
IHTMLTableRow interface
The IHTMLTableRow interface specifies a row in a table.
result.html
<html>
<body>
<!-- insert table here -->
<table id="myTable">
<tr>
<td>Name:</td>
<td>Andy</td>
<tr>
</table>
</body>
</html>
.cpp
CComPtr<IHTMLTableRow> pRow;
CComPtr<IDispatch> pDisp;
CComPtr<IDispatch> pDispCell;
CComPtr<IHTMLElement> pCellElem;
// get the table by id
if(SUCCEEDED(GetElementInterface(_T("myTable"), __uuidof(IHTMLTable), (void**)&pTable))){
// get dispatch of the row
pTable->insertRow(0, &pDisp);
pDisp->QueryInterface(&pRow);
// insert the fitst cell
pRow->insertCell(0, &pDispCell);
pDispCell->QueryInterface(&pCellElem);
pCellElem->put_innerHTML(L"Name:");
// insert the second cell
pRow->insertCell(1, &pDispCell);
pDispCell->QueryInterface(&pCellElem);
pCellElem->put_innerHTML(L"Andy");
}