protected override void NonRecursivePlaceholderFound(string placeholderTag, OpenXmlElementDataContext openXmlElementDataContext) { var row = openXmlElementDataContext.DataContext as Row; var value = GetCell(placeholderTag, row); SetContentOfContentControl(openXmlElementDataContext.Element as SdtElement, value); if (placeholderTag == TypePlaceHolder) { if (_lookupPaths.ContainsKey(value)) { var path = _lookupPaths[value]; MakeContentHyperlink(openXmlElementDataContext.Element as SdtElement, path); } } if (placeholderTag == LookupPlaceHolder) { var lookup = value; var element = (openXmlElementDataContext.Element as SdtRun).SdtContentRun.FirstChild; var bookmark = "_" + lookup; _lookupPaths.Add(lookup, bookmark); var bookMarkStart = new BookmarkStart { Id = bookmark, Name = bookmark }; element.FirstChild.InsertBeforeSelf(bookMarkStart); bookMarkStart.InsertAfterSelf(new BookmarkEnd { Id = bookmark }); } }
static void Fill(XmlNode node, BookmarkStart bookmarkStart) { bookmarkStart.InsertAfterSelf(CreateRun(node)); }