示例#1
0
        /// <summary>
        /// validate word bookmark (if exist in word but not exit in internal => highlight and markup to return)
        /// </summary>
        /// <param name="iBms"></param>
        /// <returns></returns>
        private List <string> ValidateWordBookmark(WdColorIndex color)
        {
            List <string> deletedList = new List <string>();

            foreach (Bookmark wBm in _doc.Bookmarks)
            {
                InternalBookmarkItem item = iBm.GetInternalBookmarkItem(wBm.Name);

                // 1. check null (can not find ibm)
                if (item == null)
                {
                    // todo: ngocbv_rem => confirm to remove export item
                    //if (!MarkupUtilities.IsProntoDocCommentBookmark(wBm.Name))
                    //{
                    //    deletedList.Add(wBm.Name);
                    //    HighLightBookmark(wBm.Name, color);
                    //}
                    continue;
                }

                // 2. get real biz name
                string bizName = item.IsImage() ? MarkupUtilities.GetBizNameOfBookmarkImage(wBm.Name, _doc.InlineShapes) : wBm.Range.Text;

                if (item.BizName != bizName) // compare key and value
                {
                    deletedList.Add(wBm.Name);
                    HighLightBookmark(wBm.Name, color);
                }
                else if (item != null && item.Type == XsltType.Select) // check match with domain (only check for field)
                {
                    DomainInfo domainInfo = Wkl.MainCtrl.CommonCtrl.GetDomainInfo(item.DomainName);

                    if (domainInfo != null && !domainInfo.Fields.ContainsKey(MarkupUtilities.GetOriginalBizName(wBm.Name, item.BizName)))
                    {
                        deletedList.Add(wBm.Name);
                        HighLightBookmark(wBm.Name, color);
                    }
                }
            }

            return(deletedList);
        }