TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ravi chaudhary
NA
14
7.3k
Remove underline & Cell Border
Jan 7 2015 4:34 AM
///Actually we have diffrent underline in our project Html Editor we have diffrent buttton event to remove
specific underline (Undeline can be any style user defined ) We have to check the style present in that cell
and then with the array of style and if true then remove the underline
Here i tried to use split() function and store in array but could not succeeed...
private void processUnderlineCommand(UnderLineCommand underlineCommand)
{
try
{
// define the table and row elements and obtain there values
mshtmlTable table1 = null;
mshtmlTableRow row1 = null;
mshtmlTableCell cell1 = null;
GetTableElement(out table1, out row1, out cell1);
HtmlElement table = getTableHTMLElement();
if (table != null)
{
HtmlElement selectedCell = table.GetElementsByTagName("tr")[row1.rowIndex].GetElementsByTagName("td")[cell1.cellIndex];
switch (underlineCommand)
{
case UnderLineCommand.UnderlineSinglecell:
selectedCell.Style = "border-bottom: black 3px solid; background-color: red;";
break;
case UnderLineCommand.UnderlineDoublecell:
selectedCell.Style = "border-bottom: black 3px double";
break;
case UnderLineCommand.UnderlineClearcell:
string allstyle =Convert.ToString (selectedCell.GetAttribute("style"));
string[] split = allstyle.Split(',');
foreach (string item in split)
{ // selectedCell.Style = selectedCell.Style.Replace("BORDER-BOTTOM: black 3px solid", "");
if (item.ToLower() == "border-bottom: black 3px solid,border-bottom: black 3px double")
{
selectedCell.Style = "border-bottom:None";
}
else
{
throw new HtmlEditorException("can not remove", "underlineComand");
}
}
// var cell3 = selectedCell.GetAttribute("id","underline");
// selectedCell.Style = "border:0";
//if (this.editorWebBrowser.Document.GetElementsByTagName("UnderlineSinglecell && UnderlineDoublecell");
// selectedCell.GetAttribute(, selectedCell.Style = "border-bottom: None");
// selectedCell.Style = "border-bottom: None";
break;
case UnderLineCommand.UnderlineSingleFinancialCell:
selectedCell.Style = "border-bottom: blue 1px solid";
break;
case UnderLineCommand.UnderlineDoubleFinancialcell:
selectedCell.Style = "border-bottom: blue 3px double";
break;
case UnderLineCommand.UnderlineClearFinancialcell:
selectedCell.Style = "border-bottom: None";
break;
case UnderLineCommand.UnderlineSingleline:
selectedCell.Style = "border-bottom: green 3px solid";
break;
case UnderLineCommand.UnderlineDoubleline:
selectedCell.Style = "border-bottom: Green 3px double";
break;
case UnderLineCommand.UnderlineClearline:
selectedCell.Style = "border-bottom: None";
break;
}
}
else
{
throw new HtmlEditorException("Please Select a table cell", "underlineComand");
}
}
catch (Exception ex)
{
// process the standard exception
OnHtmlException(new HtmlExceptionEventArgs(null, ex));
}
}
////// Remove cell border all.....
public void stylecell()
{
mshtmlTable table1 = null;
mshtmlTableRow row1 = null;
mshtmlTableCell cell1 = null;
GetTableElement(out table1, out row1, out cell1);
HtmlElement table = getTableHTMLElement();
try
{
if (table != null)
{
HtmlElement selectedCell = table.GetElementsByTagName("tr")[row1.rowIndex].GetElementsByTagName("td")[cell1.cellIndex];
{
selectedCell.Style = "border-top: None; border-bottom: None;border-left:None;border-left:None";
}
}
else
{
throw new HtmlEditorException("Cell not selected", "underlineComand");
}
}
catch (Exception ex)
{
// process the standard exception
OnHtmlException(new HtmlExceptionEventArgs(null, ex));
}
}
Reply
Answers (
0
)
How to Delete particular cookie in asp.net C#
display image on crystal report in windows form application