【发布时间】:2019-05-17 14:34:40
【问题描述】:
我在 Word 文档的随机位置插入一些动态文本,之后需要光标位于该文本的末尾(不是文档末尾!)。现在光标停留在之前的位置,即插入文本的开头。
我认为这里没有太多有用的代码可以显示...我只是将一些 html 复制到一个文件中并将其插入到文档中:
string tmp = AppDomain.CurrentDomain.BaseDirectory + "tmp.html";
using (StreamWriter file = new StreamWriter(tmp))
{
file.Write(report, 0, report.Length);
}
var currentCursorPosition = Globals.ThisAddIn.Application.Selection.Range;
currentCursorPosition.InsertFile(tmp);
【问题讨论】:
标签: c# ms-word cursor-position