问题描述
这是那是什么让我开始再次深入挖掘自定义道具。
Here's a link tho what made me start digging into custom Props again.
我可以看到我的customProperties为0所以我认为getCount有点工作,即使我' m通过items.length访问它而不是customProps.getCount()
I can see that my customProperties are 0 so i assume getCount is somewhat working, even though I'm accessing it through items.length and not customProps.getCount()
这仍然是有意的还是我做得不对,它可能会像在 MS Office文档
Is this still intended or am i just not doing it right and it's possible doing as in the MS Office Documentation
现在我的问题的主要部分是add方法。无论我尝试什么,它崩溃,我得到一个例外。我可以假设添加方法仍未正确实现吗?
Now the main part of my question, the add method. Whatever i try it crashes and i get an exception. Can i assume add method is still not properly implemented?
这一切都在Word API上。
This is all on Word API.
任何帮助不胜感激。非常感谢!
Any help would be appreciated. Thank you very much!
推荐答案
我验证了这段代码没有崩溃Word并且正常工作。 (假设您使用的是最新版本,如果您的items.count有效,也应该这样做。
I verified this code does not crash Word and works. (assuming you are in latest builds, if your items.count works, this should too.
Word.run(function (context) {
context.document.properties.customProperties.add("PropertyName", 1234);
return context.sync();
})
如果这不起作用,请回复您的内部版本号。
thx。
If this does not work, please reply with your build number.thx.
这篇关于(适用于Office的JavaScript API 1.3)自定义属性添加方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!