private bool ValidateTableSelection(IHTMLTable table, MarkupRange selectionMarkupRange, out bool tableFullySelected) { // assume table is not fully selected tableFullySelected = false; // first check to see that this is a "Writer" editable table if (!TableHelper.TableElementContainsWriterEditingMark(table as IHTMLElement)) { return(false); } // get elemental objects we need to analyze the table IHTMLElement tableElement = table as IHTMLElement; MarkupRange tableMarkupRange = selectionMarkupRange.Clone(); tableMarkupRange.MoveToElement(table as IHTMLElement, true); // analyze selection bool selectionAtTableStart = tableMarkupRange.Start.IsEqualTo(selectionMarkupRange.Start); bool selectionAtTableEnd = tableMarkupRange.End.IsEqualTo(selectionMarkupRange.End); // is the table fully selected? if (selectionAtTableStart && selectionAtTableEnd) { tableFullySelected = true; return(true); } else { MarkupRange selectionMarkupRange2 = selectionMarkupRange.Clone(); // is the selection bounded by the table IHTMLElement beginParentTable = selectionMarkupRange2.Start.SeekElementLeft(ElementFilters.CreateEqualFilter(tableElement)); IHTMLElement endParentTable = selectionMarkupRange2.End.SeekElementRight(ElementFilters.CreateEqualFilter(tableElement)); return(beginParentTable != null && endParentTable != null); } }