![word rich text control anywhere word rich text control anywhere](https://nishantrana.files.wordpress.com/2020/08/081020_1722_richtextedi1.png)
SdtBlock theRightSdtBlock = GetTheRightConditionalSdtBlock(theRightBlock, tag.Val) Ĭlone = (SdtBlock)theRightSdtBlock.Clone() Tag tag = props.Elements().FirstOrDefault() SdtProperties props = control.Elements().FirstOrDefault()
![word rich text control anywhere word rich text control anywhere](https://www.howtogeek.com/wp-content/uploads/2018/08/2018-08-27-3.png)
Return tag != null & tag.Val = conditialTemplate.ToLower() using (WordprocessingDocument doc = true))įoreach (var conditialTemplate in conditionalTemplates) Here is the solution so it might be useful to someone else. In the meantime I managed to solve the problem myself. Kutools for Word : with more than 100 handy Word add-ins, free to try with no limitation in 60 days. All I need is copying (only) the content within this Rich Text Content Control which wrappes the whole thing to an other Word document. If you have Kutools for Word, with its Auto Text feature, you can insert the text string into the Auto Text pane, then insert the text from the Auto Text pane to the Word file anywhere anytime. I have a Rich Text Content Control which may have plain text and a couple of Plain Text Content Controls. In other words, I'd like to copy only the content of the Rich Text Content Control without the control itself.
![word rich text control anywhere word rich text control anywhere](https://gregmaxey.com/images/word_tips/cc_forms_23.png)
I can't find the ones that were/are within the Rich Text Content Control copied from the sourceFile. Return tag != null & tag.Val = key.ToLower() This serves only to delimit a control word and is ignored in subsequent processing. The marks the end of the control word’s name and can be one of the following: A space. The ASCII Letter Sequence can contain ASCII Alphabets (a through z and A through Z).
#Word rich text control anywhere code
SdtContentBlock cloneSdtContentBlock = (SdtContentBlock)().FirstOrDefault().Clone() Ĭ(cloneSdtContentBlock, control) īut when I try to find all the Content Controls within the destinationFile using the code below string key = "tag_name" Each control word is case sensitive and starts with a backslash. In standard Wordlayout, RTCC could also be used, in fact, but more or less only in the same way as plain text content controls.
#Word rich text control anywhere full
Var tag = r.SdtProperties.GetFirstChild() As mentioned in my previous post, the full functionality of Rich Text Content Controls (RTCC) is now available with Wordlayout+. MainDocumentPart mainPart = doc.MainDocumentPart ĭictionary sdtBlocks = getContentControlsFromDocument(sourceFile) įoreach (KeyValuePair sdtBlock in sdtBlocks) using (WordprocessingDocument doc = WordprocessingDocument.Open(destinationFile, true)) Each of Rich Text Content Control(s) contains a text block and a few of Plain Text Content Controls. I'm trying to copy the content of Rich Text Content Control(s) from one to another Word document.