微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

是否可以使用 MS powerpoint 插件选择/更新形状/图标/图像属性?

如何解决是否可以使用 MS powerpoint 插件选择/更新形状/图标/图像属性?

在 Script-Lab 的 MS powerpoint office 插件中使用此示例代码,setSelectedDataAsync 能够插入 Svg。

Office.context.document.setSelectedDataAsync(
    getimageAsBase64String(),{
      coercionType: Office.CoercionType.XmlSvg,imageLeft: 50,imagetop: 50,imageWidth: 400
    },function(asyncResult) {
      if (asyncResult.status === Office.AsyncResultStatus.Failed) {
        console.error(asyncResult.error.message);
      }
    }
  );

注意:getimageAsBase64String() 是一个返回字符串的函数。此处未明确复制。

但是,当我尝试访问插入的 Svg 时,以下代码抛出错误:“不支持指定的强制类型。”

Office.context.document.getSelectedDataAsync(Office.CoercionType.XmlSvg,function (asyncResult) {
    if (asyncResult.status === Office.AsyncResultStatus.Failed) {
      console.error(asyncResult.error.message);
    } else {
      console.log(JSON.stringify(asyncResult.value,null,4));
    }
  });

我尝试过选择图像、图标、Svg、文本等,并适当地修改 CoercionType。我只能从我插入的矩形框中成功获取文本。我找不到任何东西可以用不同的颜色填充该文本框。使用 office.js 的 powerpoint 插件文档非常有限。

我想知道是否可以使用 MS powerpoint 插件来选择/更新形状/图标/图像属性

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。