Word 用 Ja​​vaScript 添加 Ins,paragraph.getHtml() 方程转换为图像

saf*_*dar 5 ms-word word-addins office-js

我正在创建一个单词插件,我想在其中获取带有图像的 html 形式的 ms word 内容。paragraph.getHtml() 返回的 html 具有图像/方程的 <img> 标签,但我无法获取该图像。


// Run a batch operation against the Word object model.
Word.run(function(context) {
    // Create a proxy object for the paragraphs collection.
    var paragraphs = context.document.body.paragraphs;

    // Queue a command to load the style property for all of the paragraphs.
    context.load(paragraphs, "style");

    // Synchronize the document state by executing the queued commands,
    // and return a promise to indicate task completion.
    return context.sync().then(function() {
      // Queue a a set of commands to get the HTML of the first paragraph.
      var html = paragraphs.items[0].getHtml();

      // Synchronize the document state by executing the queued commands,
      // and return a promise to indicate task completion.
      return context.sync().then(function() {
        console.log("Paragraph HTML: " + html.value);
        write(html.value)
      });

    });
}).catch(function(error) {
    console.log("Error: " + JSON.stringify(error));
    if (error instanceof OfficeExtension.Error) {
      console.log("Debug info: " + JSON.stringify(error.debugInfo));
    }
});

Run Code Online (Sandbox Code Playgroud)

返回这样的 img 标签
<img width=180 height=36 src="~WRS%7b11EAF911-2A25-4F41-A8C9-CEA82B5713E9%7d_files/image001.png" >

我怎样才能得到这些图像作为base64,将方程转换为图像?

谢谢