public void btnHighlightBookmark_Click(Office.IRibbonControl control) { try { TemplateInfo templateInfo = Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo; if (templateInfo != null && templateInfo.InternalBookmark != null && templateInfo.DomainNames != null && templateInfo.DomainNames.Count > 0) { DomainSelector domainSelector = new DomainSelector(); domainSelector.ShowDialog(); Dictionary <string, string> selectedDomains = domainSelector.DataTagColor; bool isHighlight = domainSelector.IsHighlight; string colorNameDS = domainSelector.DocumentSpecificConditionColor; DefineColors.DefineColor colorDS = DefineColors.GetColor(colorNameDS, false); foreach (KeyValuePair <string, string> selectedDomain in selectedDomains) { InternalBookmarkDomain ibmDomain = templateInfo.InternalBookmark.GetInternalBookmarkDomain(selectedDomain.Key); if (ibmDomain != null && ibmDomain.InternalBookmarkItems != null) { string colorNameDT = selectedDomain.Value; DefineColors.DefineColor colorDT = DefineColors.GetColor(colorNameDT, false); foreach (InternalBookmarkItem ibmItem in ibmDomain.InternalBookmarkItems) { string key = string.Empty; Pdw.WKL.Profiler.Manager.ManagerProfile profile = Wkl.MainCtrl.ManagerCtrl.CreateProfile(out key); profile.HighlightBookmarkName = ibmItem.Key; Managers.DataIntegration.DataIntegrationManager bmMgr = new Managers.DataIntegration.DataIntegrationManager(); bool isDocumentSpecific = MarkupUtilities.IsProntoDocDocumentSpecificBookmark(ibmItem.Key); if (isDocumentSpecific) { if (colorDS != null) { profile.WdColorIndex = colorDS.Color; } } else { if (colorDT != null) { profile.WdColorIndex = colorDT.Color; } } if (isHighlight) { bmMgr.HighLightBookmark(key); } else { bmMgr.UnHighLightBookmark(key); } } ibmDomain.Color = isHighlight ? colorNameDT : string.Empty; templateInfo.InternalBookmark.DocumentSpecificColor = isHighlight ? colorNameDS : string.Empty; } } } } catch (Exception ex) { LogUtils.Log("chkHighlightBookmark_Click", ex); } }