RemoveContextMenuItems()
{
AssertValid();
CommandBar oTableContextCommandBar =
ExcelTableUtil.GetTableContextCommandBar(m_oWorkbook.Application);
// Remove the separator at the top of the menu.
AddContextMenuSeparator(oTableContextCommandBar, false);
try
{
// Delete the top-level NodeXL popup menu item, which also deletes
// its child menu items.
oTableContextCommandBar.Controls[TopLevelMenuCaption].Delete(false);
}
catch (ArgumentException)
{
}
try
{
// Delete the menu item for a color cell. (This menu item doesn't
// exist for other cells.)
oTableContextCommandBar.Controls[ColorMenuItemCaption].Delete(
false);
}
catch (ArgumentException)
{
}
}