跳到主要内容

MoveCursorToEnd

将光标移动到文档末尾。

语法

expression.MoveCursorToEnd();

expression - 表示 ApiDocument 类的变量。

参数

此方法没有任何参数。

返回值

boolean

示例

将光标移动到文档的最末尾。

// How do I place the cursor at the last position in a document?

// Append text after all existing content by jumping the cursor to the end in a document.

const doc = Api.GetDocument();
const paragraph = doc.GetElement(0);
paragraph.AddText('This is the first paragraph.');

const paragraph2 = Api.CreateParagraph();
paragraph2.AddText('This is the second paragraph.');
doc.Push(paragraph2);

doc.MoveCursorToEnd();
doc.EnterText(' Cursor was moved to the end.');