我发现了类似的问题,但不完全相同。
我有一个单词模板,由用户输入的文本填充。
在用户界面上,有一个文本字段和两个签名字段(生成图像文件的第三方组件)。
如果文本不是很长,它会传递两个版本的单词。但如果文本很长并且有一些输入,则它在 Office 2019 和 Office 365 上不起作用。在 Office 2016 上,它始终有效。
为了更好地解释,
我打开文档:
Microsoft.Office.Interop.Word.Application app = null;
Microsoft.Office.Interop.Word.Document doc = null;
...
app = new Microsoft.Office.Interop.Word.Application();
doc = app.Documents.Open(tempPath);
app.Visible = false;
doc.Bookmarks["comment"].Select();
app.Selection.TypeText(orderComment); //Order comment is typed by the user
...
//this code saves the signature as a png image and it works in any case. The image exists in the folder before calling the rest of the code.
string clientSignaturePath = System.Configuration.ConfigurationManager.AppSettings["TempPath"] + Guid.NewGuid().ToString().Substring(0, 6) + …Run Code Online (Sandbox Code Playgroud)