跳到主要内容

SetModified

设置文档最后修改的日期。

语法

expression.SetModified(oModified);

expression - 表示 ApiCore 类的变量。

参数

名称必需/可选数据类型默认值描述
oModified必需Date文档最后修改的日期。

返回值

此方法不返回任何数据。

示例

设置文档的最后修改日期。

// How do I update the modification timestamp of a document?

// Correct or backdate the recorded edit time to reflect when a document was actually changed in a document.

const doc = Api.GetDocument();
const core = doc.GetCore();
core.SetModified(new Date('1990-03-10'));

const lastModifiedDate = core.GetModified().toDateString();
let paragraph = doc.GetElement(0);
paragraph.AddText("Last modified: " + lastModifiedDate);