OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
686 stars 95 forks source link

Word - Function context.document.body.insertFileFromBase64 stopped working #3040

Open emmanuelpineda opened 1 year ago

emmanuelpineda commented 1 year ago

Without making any changes to the Add In code, the function context.document.body.insertFileFromBase64 stopped working about 2 weeks ago. I assume this is due to some Office API update.

Your Environment

Expected behavior

Calling the context.document.body.insertFileFromBase64(base64File, Word.InsertLocation.replace) function is expected to insert the content into the current document

Current behavior

The context.document.body.insertFileFromBase64(base64File, Word.InsertLocation.replace) function throws an error and does not insert the content

Steps to reproduce

Just call the function context.document.body.insertFileFromBase64(base64String, Word.InsertLocation.replace) from office on the web. Fails with any base 64 file string

Context

This function is useful for our learning project so that the user does not start from scratch to create a document

Useful logs

image

emmanuelpineda commented 1 month ago

Hello @xiaoyu03,

We have a new problem with the method: insertFileFromBase64, it does not throw any error but does not insert the content, it worked well in the past days and now it is not working. Please we need your help, we have a large number of users (students) who use the Jasperactive Add In and are stuck when starting this new school year.

knopmickael commented 1 month ago

@emmanuelpineda review your base64 string, the behavior was the same here some weeks ago, but the guys fixed it recently

The real problem was:

Check this other issue, I detailed our working case (https://github.com/OfficeDev/office-js/issues/4682#issuecomment-2369243454)

emmanuelpineda commented 1 month ago

Thank you for the info @knopmickael!, I'll check the Word document

xiaoyuMS commented 1 month ago

Hi @emmanuelpineda,

May I know if the API works for you now? If not, could you share some failed samples with us to repro the issue?

SirDavenport commented 1 month ago

Hi @xiaoyuMS , Actually now that you mention it, the insert does not always work for me either. Just tried to insert a relatively big word document into a content control and it briefly shows the "inserting" loading spinner, and then just doesn't do anything and these errors show up image

xiaoyuMS commented 1 month ago

@SirDavenport

This looks like a new issue. Did it continue to happen for particular insertion? If so, is it possible to provide the repro steps with us?