Hi There
I am using the .NET WebBrowser control to as a WYSIWYG html editor. I've been using the ExecCommand to do the formatting function fine so far, however I now want to add a table inserter. The problem is I can only seem to Append the table to the document, not insert it half way through. Below is some basic test code, if anyone can help, I'd appreciate it.
HtmlElement tableRow = null;
HtmlElement headerElem = null;
HtmlDocument doc = wbDesign.Document;
HtmlElement tableElem = doc.CreateElement("TABLE");
doc.Body.AppendChild(tableElem);
HtmlElement tableHeader = doc.CreateElement("THEAD");
tableElem.AppendChild(tableHeader);
tableRow = doc.CreateElement("TR");
tableHeader.AppendChild(tableRow);
headerElem = doc.CreateElement("TH");
headerElem.InnerText = "Col1";
tableRow.AppendChild(headerElem);
headerElem = doc.CreateElement("TH");
headerElem.InnerText = "Col2";
tableRow.AppendChild(headerElem);
HtmlElement tableBody = doc.CreateElement("TBODY");
tableElem.AppendChild(tableBody);
tableRow = doc.CreateElement("TR");
tableBody.AppendChild(tableRow);
HtmlElement tableCell = doc.CreateElement("TD");
tableCell.InnerText = "Test";
tableRow.AppendChild(tableCell);
tableCell = doc.CreateElement("TD");
tableCell.InnerText = "Test";
tableRow.AppendChild(tableCell);