5

I'm creating a word addIns, where I want to get ms word contents as html with images. paragraph.getHtml() returned html has <img> tags for Images/equations but i'm not able to get that image.


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

returned img tag like this
<img width=180 height=36 src="~WRS%7b11EAF911-2A25-4F41-A8C9-CEA82B5713E9%7d_files/image001.png" >

How can i get these images as base64 which is converted equations to images?

Thank you

Cindy Meister
  • 25,071
  • 21
  • 34
  • 43
safdar
  • 51
  • 2
  • I am also seeing this problem. I tried this on Word Online and there the image is base64 encoded, as I would also expect. – Hlynur Mar 11 '20 at 13:02

0 Answers0