Ms word Word加载项和JavaScript,段落.getHtml()转换为图像

Ms word Word加载项和JavaScript,段落.getHtml()转换为图像,ms-word,office-js,word-addins,Ms Word,Office Js,Word Addins,我正在创建一个word addIns,在这里我希望将ms word内容作为带有图像的html。 paragration.getHtml()已返回html 如何将这些图像转换为base64格式的图像 谢谢我也看到了这个问题。我在Word Online上尝试了这个方法,图像是base64编码的,正如我所期望的那样。 // Run a batch operation against the Word object model. Word.run(function(context) { //

我正在创建一个word addIns,在这里我希望将ms word内容作为带有图像的html。 paragration.getHtml()已返回html

如何将这些图像转换为base64格式的图像


谢谢

我也看到了这个问题。我在Word Online上尝试了这个方法,图像是base64编码的,正如我所期望的那样。

// 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));
    }
});