Relative Content

Tag Archive for c#xmlms-wordopenxml

C# OpenXML LeafElement InnerXml can only be set to null or to an empty string

I am using the OpenXML .NET Library to work on a WordprocessingML document. I need to replace/set the text for a <t> element, but when I do it like this: Element.InnerXml = value i get this error: System.InvalidOperationException: 'This OpenXmlLeafElement's InnerXml can only be set to null or to an empty string.'. I looked into the documentation, but it seems incomplete and does not mention this error. This behaviour is unique to some of the leaf nodes (for now I only found it with Text/<t>), as I can set the parent InnerXml without an issue.