Check it for things that aren't allowed in a content control. My feeling is, to first get the content of each bookmark (the node tree). This is tricky, partly because bookmarks - unlike content controls - can overlap so many things, including paragraphs and each other. Let me know, if you have any questions on the approach. I think my above example shows the input and the target to achieve. This is the required output after placing content controls over the bookmark ranges: This is my Sample document.xml contents with Bookmarks over there: Lets say, my input document.xml (using open xml sdk) looks like this with Bookmarks: I need Rich Text Content control on the bookmark ranges. I have a bookmarked document where all the contents are inside bookmarks. If (bookmarkText != null & bookmarkStart.Name != "_GoBack") IDictionary bookmarkMap = new Dictionary() įoreach (BookmarkStart bookmarkStart in ())īookmarkMap = bookmarkStart įoreach (BookmarkStart bookmarkStart in bookmarkMap.Values)ĭ bookmarkText = bookmarkStart.NextSibling() Using (WordprocessingDocument wDoc = WordprocessingDocument.Open(fileName, true)) //path is where your word 2007 file is String fileName = this content control to the body of the word document “SdtRun” to add a check box to the paragraph. ![]() ![]() In the sample, I find the paragraph of the bookmarks, and generate a ![]() ![]() I write a sample to add a Check Box Content Control to the end of the paragraph in which I set a bookmark for your reference. Which content control do you want to add to the bookmark range? And what location you would like the control to be add? Front, middle or Last?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |