//COM 接口 - 修改集合值 /* 调用 Word VBA: doc://example/Languages/VBA%20JSA/Word.html web.view 预览 Word 文档: doc://example/WebUI/web.view/OtherApps/docx.html */ import com.doc; var docx = com.doc("/test.docx") docx.Visible = true; //比较特殊,其他对象通常不会遇到这个问题 //BuiltinDocumentProperties 不支持直接读写 "title" 属性 //docx.ActiveDocument.BuiltinDocumentProperties["Title"] = "新标题"; //var title = docx.ActiveDocument.BuiltinDocumentProperties["Title"].value //需要带着 "Title" 参数去读写 BuiltinDocumentProperties 这个集合自身 docx.ActiveDocument.setBuiltinDocumentProperties("Title", "新标题"); //写入可以直接指定字符串值 var title = docx.ActiveDocument.getBuiltinDocumentProperties("Title").value;//读出来是 DocumentProperty 对象 print( title ); docx.Save(); //docx.quit();