const DocumentProperties = await app.ActiveDocument.CustomDocumentProperties
// 创建新的自定义文档属性
await DocumentProperties.Add({
Name: 'WebOffice',
Value: 'test_id'
})
我该如何读取这个自定义属性的值
const DocumentProperties = await app.ActiveDocument.CustomDocumentProperties
// 创建新的自定义文档属性
await DocumentProperties.Add({
Name: 'WebOffice',
Value: 'test_id'
})
我该如何读取这个自定义属性的值
你好,这边遇到的困难时, 我在文档中添加了此属性,然后我需要在程序中获取到此属性的值 <img src="https://solution-community.wps.cn/uploads/post/4VKPF1eFmFS.png" alt="image.png"/>
我看了文档只有添加属性 https://solution.wps.cn/docs/client/api/Word/DocumentProperties.html#add
// 获取应用对象
var app = instance.Application;
const DocumentProperties = await app.ActiveDocument.CustomDocumentProperties
**这里如何获取到在文档中添加的属性值pmcs**
<img src="https://solution-community.wps.cn/uploads/post/4VLhN8bwNyq.png" alt="image.png"/> <img src="https://solution-community.wps.cn/uploads/post/4VLhS9ikSDf.png" alt="image.png"/> 能读到这种指定的属性值吗 @技术支持-zsg
表达式.ActiveDocument.CustomDocumentProperties
表达式:文档类型应用对象
示例如下:
//@file=base.docx
async function example() {
await instance.ready()
const app = instance.Application
// CustomDocumentProperties 对象
const CustomDocumentProperties = await app.ActiveDocument
.CustomDocumentProperties
}
参考文档:https://solution.wps.cn/docs/client/api/Word/Document.html#customdocumentproperties