

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. All I need is copying (only) the content within this Rich Text Content Control which wrappes the whole thing to an other Word document. 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. 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()
Word vs word rich 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" Var tag = r.SdtProperties.GetFirstChild() 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.
