TaskPane Word App - 将数据与图像或形状相关联 [英] TaskPane Word App - associating data with images or shapes

查看:78
本文介绍了TaskPane Word App - 将数据与图像或形状相关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为Word制作了简单的任务窗格应用程序,允许用户选择形状,然后为其附加一些属性。我正在使用带有"ooxml"的getSelectedDataAsync方法。格式然后通过处理xml来检测其中是否有形状。我被困在
有问题 - 我没办法检测是否从应用中删除了形状。

I have made simple task pane app for Word which allows user to select shape and then attach some properties to it. I am using getSelectedDataAsync method with "ooxml" format and then detect if there is shape in there by processing xml. I am stuck with a problem - there is no way for me to detect if shape was deleted from the app.

     我尝试使用Bindings对象的addFromSelection方法创建绑定,但是当选择了形状或图像时,这会失败,错误代码为3000.

     I tried to create binding using addFromSelection method of Bindings object but when shape or image selected this fails with error code 3000.

     作为替代选项,我想添加"从文档更新"。按钮,它只会遍历整个文档,并检查项目是否仍然存在,但getFileAsync方法不允许我获取文档的OOXML,只有
压缩或文本。

     As alternative option I was thinking to add "Update from document" button which would just traverse whole document and check if items are still there but getFileAsync method does not allow me to get OOXML of the document, only Compressed or Text.

   我可以尝试其他任何选项吗?

    Are there any other options I can try?

推荐答案

嗨Asterixer,

Hi Asterixer,

最好能为我提供相关的代码。

It's better that you could provide the related code to me.

要检测是否删除了形状或图像,可以尝试绑定
Office.EventType.BindingSelectionChanged
事件,之后如果删除形状或图像,则会发生。

To detect if the shape or image is deleted or not, you could try to bind Office.EventType.BindingSelectionChanged event, after that if you delete the shape or image, it will occurs.

#EventType枚举

http:// msdn。 microsoft.com/en-us/library/office/fp161159(v=office.1501401).aspx

添加事件绑定到图像和形状,请点击它并按Ctrl + A选择所有范围。

To add event binding to the image and shape, please click it and press Ctrl+A to select the all range.

最好的问候

Starain


这篇关于TaskPane Word App - 将数据与图像或形状相关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆