I insert some dynamic text at a random position of a Word document and need the cursor to be sitting just at the end of this text afterwards (NOT end of document!). By now the cursor stays in the position it was before, which is at the beginning of the inserted text.
Not much useful code to show here I think ... I just copy some html into a file and insert it into the document:
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);