I have a VSTO Add-in in which I insert some formatted text into Selection.Range. Text is provided in Open XML format and is inserted to the document with InsertXML method:
using (var selection = _application.Selection)
{
var range = selection.Range;
range.Collapse(WdCollapseDirection.wdCollapseEnd);
range.InsertXML(xml);
}
This works fine if the cursor is in wdMainTextStory. However, if I place it in a footnote, it does not work. It doesn't throw any error, but the text is just not inserted at all. I tried to watch range.Text and range.XML and it appears that they stay the same.
I tried to put the plain text by:
range.Text = "TEST";
And it worked.
Is there a way to put an XML into footnote's range? Am I doing something wrong here?