I have written code for split table .it split the table from row index where it is . It works fine and it split the table but the space between the table is very minute (less) .i have tried it using
tag but it give error and and inserting Nbsp too...it worked fine but i don't want to use nbsp because it will get removed when i will run my clean up button in my tool to remove unnecessary tags....
plz.. help ...got ..stucked ...Code for split table is attached.....
private void splittable()
{
mshtmlTable table1 = null;
mshtmlTableRow row1 = null;
mshtmlTableCell cell1 = null;
GetTableElement(out table1, out row1, out cell1);
HtmlElement table = getTableHTMLElement();
int rowIndex = row1.rowIndex;
// HtmlElement space = this.editorWebBrowser.Document.CreateElement("p");
HtmlElement splittedTable = this.editorWebBrowser.Document.CreateElement("table");
splittedTable.Style = table.Style;
splittedTable.SetAttribute("border", table.GetAttribute("border"));
splittedTable.SetAttribute("cols", table.GetAttribute("cols"));
splittedTable.SetAttribute("cellPadding", table.GetAttribute("cellPadding"));
splittedTable.SetAttribute("cellSpacing", table.GetAttribute("cellSpacing"));
splittedTable.SetAttribute("width", table.GetAttribute("width"));
splittedTable.SetAttribute("cell.colspan", table.GetAttribute("cell.colspan"));
splittedTable.SetAttribute("cell.rowspan", table.GetAttribute("rowspan"));
//cellSpacing=0 cols=3 cellPadding=0 width="50%" border=1
HtmlElement splittedTableBody = this.editorWebBrowser.Document.CreateElement("tbody");
HtmlElement row = null;
if (table != null)
{
for (int i = 0; i <= rowIndex; i++)
{
row = this.editorWebBrowser.Document.CreateElement("tr");
row.OuterHtml = table.GetElementsByTagName("tr")[i].OuterHtml;
row.Style = table.GetElementsByTagName("tr")[i].Style;
foreach (HtmlElement element in table.GetElementsByTagName("tr")[i].GetElementsByTagName("td"))
{
HtmlElement newElement = this.editorWebBrowser.Document.CreateElement(element.TagName);
newElement.InnerHtml = element.InnerHtml;
newElement.Style = element.Style;
newElement.SetAttribute("colSpan", element.GetAttribute("colSpan"));
row.AppendChild(newElement);
}
splittedTableBody.AppendChild(row);
}
for (int i = 0; i <= rowIndex; i++)
{
table1.deleteRow(0);
}
splittedTable.AppendChild(splittedTableBody);
}
table.OuterHtml = splittedTable.OuterHtml + table.OuterHtml;
}


Naitik JaniRank #5,681 · 290 reputationPosted Apr 13, 2015, 9:21 PM EDT
I have not checked your Code in detail. But can you try
Aisha SrivastavaRank #7,688 · 236 reputationPosted Apr 15, 2015, 9:59 PM EDT
tag....it delete the row ...