ravi chaudhary

ravi chaudhary

  • NA
  • 14
  • 7k

Underline single cell in Html table

Dec 24 2014 5:50 AM
How to write code for underline single cell in mshtml table...
I have made code for  underline all  cell but could not do for single cell on which user wants...
Code is attached below...
 
private void Underline single cell()
{
try
{
mshtmlElement tableElement = GetHTMLElementOfTable();
tableElement.setAttribute("id", "DataTable");
HtmlElement table = this.editorWebBrowser.Document.GetElementById("DataTable");
if (table != null)
{
//you can get rows like that
int i = 1;
foreach (HtmlElement row in table.GetElementsByTagName("tr"))
{
foreach (HtmlElement cell in row.GetElementsByTagName("td"))
{
////cell.InnerText = i.ToString();
cell.Style = "BORDER-BOTTOM: thick solid #0000FF;";
i++;
}
}
}
else
{
throw new HtmlEditorException("Please Select a table table", "ActionTableConvert");
}
}
catch (Exception ex)
{
// process the standard exception
OnHtmlException(new HtmlExceptionEventArgs(null, ex));
}
}
 

Answers (2)