2017-01-23 115 views

回答

1

要添加更多细节到以前的答案:是的Word.js 1.3介绍了自定义和内置文档属性的创建和检索。 API仍处于预览状态,您至少需要12月分叉构建才能使用此功能。确保你在16.0.7766 +版本上试用它。此外,请务必使用我们的预览CDN的Office.js https://appsforoffice.microsoft.com/lib/beta/hosted/office.js

下面是关于如何在Word中创建自定义属性的代码示例:

function createCustomProperty(){ 
     Word.run(function (context) { 
      //method accepts property name plus value 
      context.document.properties.customProperties.add("property_name", 123); 
      return context.sync() 
      .catch(function (e) { 
       console.log(e.message); 

      }) 

     }) 

    } 

退房的文件看其他功能,包括获得内置属性 https://github.com/OfficeDev/office-js-docs/blob/WordJs_1.3_Openspec/reference/word/documentproperties.md

希望这会有所帮助, 谢谢! 胡安。

0

Word API 1.3介绍documentProperties和CustomProperty的,但状态仍列为预览,需要的Word 2016桌面版1605(建6925.1000)或更高版本或移动应用(尚未在线)。

相关问题