Set text in an existing contentcontrol in word 2010 with c# and VSTO
-
29-10-2019 - |
Вопрос
I've been looking and googling around for 4h to find a solution for my problem.
I'm trying to set the text of an defined rich text content control. For test purposes i defined just one content control (rich text) in the document where i would like to change the text.
var docx = Application.Documents.Open(@"D:\BaseDocs\Test.docx");
var all = GetAllContentControls(docx); // Returns all content controls in active document
var one = all.First(); // Select first one --> works
((RichTextContentControl)one).Text = "Test" //Trying to set text --> invalid cast exception
I can't set the value of this predefined content control. Any help is really appreciated.
Нет правильного решения
Не связан с StackOverflow