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
670 stars 96 forks source link

insertFileFromBase64 does not work from a WOPI session #1944

Open AndyHore opened 3 years ago

AndyHore commented 3 years ago

Provide required information needed to triage your issue

Our product uses WOPI to launch our users Word edit session from our product. The user loads our (Web) Add-in, and uses it to select another file from our repository to be inserted into the current document. We used insertFileFromBase64 to do this insert, and it works perfectly from a Desktop or office.com session, but not from a WOPI session.

Your Environment

Expected behavior

For the insert to work in WOPI just as it does for Desktop or office.com!

Current behavior

Nothing happens,

Steps to reproduce

  1. Create a add-in that uses insertFileFromBase64 to insert a Word file.
  2. Launch a WOPI Word edit session, load the add-in
  3. Execute the insert operation

Link to live example(s)




Provide additional details




Context

We switched to using insertHtml, which loses a whole stack of functionality with respect to the formatting within the Word document being inserted.

Useful logs

Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.

AndyHore commented 2 years ago

Is there any update on the status for this defect? This is causing MAJOR problems for our customers because the alternative is inserting from HTML, and that loses formatting.

RuoyingLiang commented 2 years ago

@AndyHore, sorry for the late response. We are looking into this issue and will reply here once we have update.

AndyHore commented 2 years ago

@RuoyingLiang , is there any update on this? We have customers asking on a daily basis if this is being fixed because they caanot use our product with the change.

RuoyingLiang commented 2 years ago

@AndyHore sorry for the late response. Unfortunately the insertFileFromBase64 API doesn't support WOPI env well. We have an internal item to track (There was a github thread for the same ask https://github.com/OfficeDev/office-js/issues/1341 ). But we don't any concrete timeline to share yet.

AndyHore commented 2 years ago

@RuoyingLiang , thanks for the update, even if it isn't good news! What can we do to raise visibility on this? Your linked thread gives a link to something called "User Voice" and that's now dead! For our customers, WOPI is not an option for them without this working and there IS no alternative...

grangeryy commented 2 years ago

@AndyHore, you may raise the requirement on Ideas Forum which is the replacement of UserVoice

AndyHore commented 2 years ago

@grangeryy , do we have to re-submit all our defects as ideas on the other forum (because they will be ignored here...)? And if this forum dead at this point?

wangyun-microsoft commented 2 years ago

@AndyHore For insertFileFromBase64, it is in our list, and we are looking at the possible enhancement here. For the defects, they are not ignored. We actively review the list and prioritize what is requested. For new ideas or requirements that you would like to get votes from others, Ideas Forum is a valid channel to go. Thanks.

AndyHore commented 2 years ago

@grangeryy, ok, thanks for clarifying.

SirDavenport commented 10 months ago

Howdy, Any update on the insertFileFromBase64 fix?

wangyun-microsoft commented 5 months ago

@AndyHore , @SirDavenport , We recently fixed the insertFileFromBase64 issue on WOPI host. Can you take a try to see if the problem still exists?

Thanks.

AndyHore commented 3 months ago

@wangyun-microsoft , sorry, should have given an update before. We've been testing and had initially run into issues with the fix working on certain files. We had a ticket with CSP, and it now appears that the initial issue is fixed. We do, however, still have a secondary issue where styling is not being preserved during the insert. Again, we have a CSP ticket.

mmoloney9966 commented 3 months ago

Recently, MSFT/CSPP/OfficeJS InsertFileAsBase64 started working sometimes. So, progress but still having issues where occasionally it throws errors. Either a message box titled "Insert Error" with a single word for the error message of 'oocmilsMalformated'. We have been testing with the attached docx file for the insert operation. WOPI insertfileasbase64 testing.docx

Beyond the error, when it does work, we are also seeing the attached file lose styling. The upper and lower border is not present on the first line and the 2nd and 3rd lines get their font changed to Times New Roman. So, once the error is addressed, we'll still have issues with the loss of styling for the inserted document.

wangyun-microsoft commented 3 months ago

Thanks for the update @AndyHore and @mmoloney9966. We'll use the testing doc @mmoloney9966 provided to take further look.

xiruatms commented 3 months ago

@AndyHore @mmoloney9966 , thanks for verifying this.

@mmoloney9966 , for your case, I've taken a try with the testing file you shared.

  1. I didn't repro the intermittent failure you mentioned, can you find a way to reproduce it consistently?
  2. Regarding the style differences. I think it's not something "losing", but something related to differences. I assume the testing file was edited firstly with Word Desktop, that's why you're expecting something as following: image

If I directly open this file with Word Online without using insertfilefrombase64, I got following: image

This is consistent with what I got using insertfilefrombase64. That's current differences for style "Intense Quote" between Word Desktop and Word Online.

  1. For the font, it's related to the default paragraph font given the character styles related to the styles used in the testing file are mostly "default paragraph font".

Please correct me if I have any misunderstanding here.

mmoloney9966 commented 3 months ago
  1. Have not found a way to reproduce the insertFileFromBase64 every attempt but it happens frequently enough that we could not advise our customers to use the feature.
  2. ….
  3. If I open the “insert” file directly in a WOPI editing session, the fonts are not changed. Are you saying the “parent” document that is the target of the insert has styling that is overriding the font styles present in the inserted file?

From: xiruatms @.> Sent: Tuesday, May 28, 2024 5:58 PM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

@AndyHorehttps://github.com/AndyHore @mmoloney9966https://github.com/mmoloney9966 , thanks for verifying this.

@mmoloney9966https://github.com/mmoloney9966 , for your case, I've taken a try with the testing file you shared.

  1. I didn't repro the intermittent failure you mentioned, can you find a way to reproduce it consistently?
  2. Regarding the style differences. I think it's not something "losing", but something related to differences. I assume the testing file was edited firstly with Word Desktop, that's why you're expecting something as following: image.png (view on web)https://github.com/OfficeDev/office-js/assets/40648203/e547c2b3-ac5f-432f-8ff2-bc8342094dfb

If I directly open this file with Word Online without using insertfilefrombase64, I got following: image.png (view on web)https://github.com/OfficeDev/office-js/assets/40648203/767d64d4-f8dc-409a-8ce8-85ee8898671f

This is consistent with what I got using insertfilefrombase64. That's current differences for style "Intense Quote" between Word Desktop and Word Online.

  1. For the font, it's related to the default paragraph font given the character styles related to the styles used in the testing file are mostly "default paragraph font".

Please correct me if I have any misunderstanding here.

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2136173514, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHU5YOGAABDOHC2KZG3ZET4XJAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJTGYYTOMZVGE2A. You are receiving this because you were mentioned.Message ID: @.**@.>>

xiruatms commented 3 months ago
  1. @mmoloney9966 , can you share some details of your WOPI environment? can I have some testing accounts to take a try there?

  2. From the testing file you provided, I can tell that most of the styles in that file referenced to "defaultparagraphfont". So I would say not "overriding", but a "by-design" behavior. That is, the font will be consistent with the default font used in the so-called "parent" document.

mmoloney9966 commented 3 months ago
  1. Not sure I can get you access to our environments. I’ll work on that. In the meantime, if it helps….

Attached zip of network capture’s har file captured when got the error during the processing of the InsertFileAsBase64 .

Attached zip of Word document containing the screenshot of the wopi editing session and error message error.screenshot.docx wopi.word.insertfailed.ooxmllsMalformated.har.zip

  1. If the behavior it to use the default paragraph font, why doesn’t the "Intense Quote" styling get morphed as well?

Where do I look to see that most of the styles in the file referenced to “defaultparagraphfont”?

Are there any options we can pass to that InsertFileAsBase64 call to preserve styling? Otherwise, I imagine our customers will not want to use the feature since their intent is to insert the file while maintaining its styling. Currently, the “insert using html” does a better job relative to the styling but can often lose formatting/styling stuff since html only supports so much. The hope was inserting as base64 would preserve the content’s styling and formatting which would then satisfy our customers’ requirement.

xiruatms commented 3 months ago

@mmoloney9966 , thank for providing more information.

  1. The har file is helpful, but I didn't find further information there. That'll be great if you can grant me the access to your WOPI instance.

  2. I'm not sure I understand this clearly: "why doesn’t the "Intense Quote" styling get morphed as well?" In my verification, the font of "Intense Quote" was update accordingly.

For your question: Where do I look to see that most of the styles in the file referenced to “defaultparagraphfont”?

My responses are as following: You can check this with ooxml for this document.

Another way is to following instruction here: https://support.microsoft.com/en-us/office/change-the-default-font-in-word-2f50603b-9886-47e4-a483-48ac5ab80163

After you change the default font, you'll see most default styles will updated accordingly ("Intense Quote" is included)

image

You may find the font of "Title" was not changed, given there're explicit font definition in "Title": image

So if you want to keep the styling consistent across document. One alternative might be customization of your own styling to specify all the details.

mmoloney9966 commented 3 months ago

Will be checking into getting you access to a working system but, worst case, may only have the option to screen share IF management disagrees on giving access to our application to a non-customer.

To be able to ask an obvious question from management, are you a Microsoft employee? If so, that may help since we may already have non-disclosure agreements in place via our MSFT support contracts.

From: xiruatms @.> Sent: Thursday, May 30, 2024 9:45 PM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

@mmoloney9966https://github.com/mmoloney9966 , thank for providing more information.

  1. The har file is helpful, but I didn't find further information there. That'll be great if you can grant me the access to your WOPI instance.
  2. I'm not sure I understand this clearly: "why doesn’t the "Intense Quote" styling get morphed as well?"

Where do I look to see that most of the styles in the file referenced to “defaultparagraphfont”? You can check this with ooxml for this document.

Another way is to following instruction here: https://support.microsoft.com/en-us/office/change-the-default-font-in-word-2f50603b-9886-47e4-a483-48ac5ab80163https://support.microsoft.com/en-us/office/change-the-default-font-in-word-2f50603b-9886-47e4-a483-48ac5ab80163

After you change the default font, you'll see most default styles will updated accordingly ("Intense Quote" is included)

image.png (view on web)https://github.com/OfficeDev/office-js/assets/40648203/655eb29c-2282-4787-97c3-cdd5ac637997

You may find the font of "Title" was not changed, given there're explicit font definition in "Title": image.png (view on web)https://github.com/OfficeDev/office-js/assets/40648203/a222c0dc-5468-471e-9441-a6f2b9440561

So if you want to keep the styling consistent across document. One alternative might be customization of your own styling to specify all the details.

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2141095997, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHUMKSTVANVPKG7CG3DZE7I3BAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJUGEYDSNJZHE3Q. You are receiving this because you were mentioned.Message ID: @.**@.>>

xiruatms commented 3 months ago

@mmoloney9966 , yes, I'm a MSFT employee. That's great if you have the contacts. Furthermore, you can submit your contact information here: https://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR9NvrlmrippKsMvh4kTM325URVZMWjYyQTVOTVNLTUo5VzFRTTcyNU1RSy4u

We'll contact you soon when we get it.

mmoloney9966 commented 3 months ago

Working with my manager on this.

In the meantime, would a screen share on a teams or zoom meeting work or do you need more “on-demand” access?

From: xiruatms @.> Sent: Wednesday, June 5, 2024 10:06 PM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

@mmoloney9966https://github.com/mmoloney9966 , yes, I'm a MSFT employee. That's great if you have the contacts. Furthermore, you can submit your contact information here: https://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR9NvrlmrippKsMvh4kTM325URVZMWjYyQTVOTVNLTUo5VzFRTTcyNU1RSy4uhttps://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR9NvrlmrippKsMvh4kTM325URVZMWjYyQTVOTVNLTUo5VzFRTTcyNU1RSy4u

We'll contact you soon when we get it.

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2151281470, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHR7TGM4S6RI2HL4KWLZF67WZAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJVGEZDQMJUG4YA. You are receiving this because you were mentioned.Message ID: @.**@.>>

xiruatms commented 3 months ago

@mmoloney9966 . Considering your case might be a different issue, I would suggest you to create another github issue to make the tracking messages explicit and clear.

@AndyHore , as I've seen you confirmed that "the initial issue is fixed", I'm going to close this issue. But feel free to create another one if you have further questions.

mmoloney9966 commented 3 months ago

Andy’s confirmation of the initial issue is fixed was premature. As our QA department did more testing, the error returned.

From: xiruatms @.> Sent: Thursday, June 6, 2024 10:33 PM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

@mmoloney9966https://github.com/mmoloney9966 . Considering your case might be a different issue, I would suggest you to create another github issue to make the tracking messages explicit and clear.

@AndyHorehttps://github.com/AndyHore , as I've seen you confirmed that "the initial issue is fixed", I'm going to close this issue. But feel free to create another one if you have further questions.

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2153742689, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHRRKFFE2EC7C37ASDDZGELVZAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJVGM3TIMRWHA4Q. You are receiving this because you were mentioned.Message ID: @.**@.>>

mmoloney9966 commented 3 months ago

I’ve gotten the OK to get you access into our application so you can troubleshoot on-demand.

Attaching the XML definition file for our webaddin to copy into a local folder in order to manually upload/add our webaddin to the WOPI editing session’s browser window.

Our login portal URL for your testing is….

            https://qpalogin-stg1.qvidian.com/login.aspx?

Your login information:

  1. User Name: @.**@.>
  2. Password: xiruatmsPW1!

Once you login, you will land on the home page. Within the home page is a single widget “Documents & Projects”.

  1. Click on the Project Name line for “InsertFileAsBase64 test” to open the project.
  2. Once project opens, double-click on the “Sample Beta RFP.docx” image in the right panel under the RFP Workspace section/heading
  3. Once that file is loaded into the right panel, right mouse click the “1. Endeavoring to obtain maximum index scoring based on Title” line.
  4. Önce the context menu opens, click the “Edit Original in Office Online” menu option.
  5. Once the WOPI editing session tab/window opens, click the X in the “Qvidian (US)” add-in panel on the right side.
  6. In the toolbar, click the Add-Ins icon @.***
  7. Click the “+ More Add-ins” button in the Add-ins dialog/panel
  8. Once the “Office Add-ins” dialog is displayed, click the “File Host” toolbar item
  9. Click the “Upload My Add-in” option in the upper right.
  10. Browse to the folder where you copied the attached Qvidian.STG1.xml file, select the file, then, click the Upload button.
  11. Click the More Options icon [A yellow line with black dots Description automatically generated] in the toolbar and click on the entry for

[A screenshot of a computer Description automatically generated]

  1. You may be presented with a Qvidian Welcome page. Click the “Log in” button and use the same username/password as you did to login to the application to start.
  2. The Qvidian WebAddin panel should then display the Library search UI.
  3. Click the “Search” button.
  4. A single search result should be displayed for “WOPI_insertfileasbase64_testing”
  5. Hover your mouse over that result entry and an “Insert Below” button will display.
  6. Click that button and our webaddin will invoke the InsertFileAsBase64 method and, typically, an error message is displayed from that method throwing an error.

@.***

From: xiruatms @.> Sent: Thursday, June 6, 2024 10:33 PM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

@mmoloney9966https://github.com/mmoloney9966 . Considering your case might be a different issue, I would suggest you to create another github issue to make the tracking messages explicit and clear.

@AndyHorehttps://github.com/AndyHore , as I've seen you confirmed that "the initial issue is fixed", I'm going to close this issue. But feel free to create another one if you have further questions.

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2153742689, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHRRKFFE2EC7C37ASDDZGELVZAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJVGM3TIMRWHA4Q. You are receiving this because you were mentioned.Message ID: @.**@.>>

mmoloney9966 commented 3 months ago

CC’g Andy Hore to keep him informed….

From: Michael Moloney Sent: Monday, June 10, 2024 11:24 AM To: OfficeDev/office-js @.>; OfficeDev/office-js @.> Cc: Mention @.***> Subject: RE: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

I’ve gotten the OK to get you access into our application so you can troubleshoot on-demand.

Attaching the XML definition file for our webaddin to copy into a local folder in order to manually upload/add our webaddin to the WOPI editing session’s browser window.

Our login portal URL for your testing is….

            https://qpalogin-stg1.qvidian.com/login.aspx?

Your login information:

  1. User Name: @.**@.>
  2. Password: xiruatmsPW1!

Once you login, you will land on the home page. Within the home page is a single widget “Documents & Projects”.

  1. Click on the Project Name line for “InsertFileAsBase64 test” to open the project.
  2. Once project opens, double-click on the “Sample Beta RFP.docx” image in the right panel under the RFP Workspace section/heading
  3. Once that file is loaded into the right panel, right mouse click the “1. Endeavoring to obtain maximum index scoring based on Title” line.
  4. Önce the context menu opens, click the “Edit Original in Office Online” menu option.
  5. Once the WOPI editing session tab/window opens, click the X in the “Qvidian (US)” add-in panel on the right side.
  6. In the toolbar, click the Add-Ins icon @.***
  7. Click the “+ More Add-ins” button in the Add-ins dialog/panel
  8. Once the “Office Add-ins” dialog is displayed, click the “File Host” toolbar item
  9. Click the “Upload My Add-in” option in the upper right.
  10. Browse to the folder where you copied the attached Qvidian.STG1.xml file, select the file, then, click the Upload button.
  11. Click the More Options icon [A yellow line with black dots Description automatically generated] in the toolbar and click on the entry for

[A screenshot of a computer Description automatically generated]

  1. You may be presented with a Qvidian Welcome page. Click the “Log in” button and use the same username/password as you did to login to the application to start.
  2. The Qvidian WebAddin panel should then display the Library search UI.
  3. Click the “Search” button.
  4. A single search result should be displayed for “WOPI_insertfileasbase64_testing”
  5. Hover your mouse over that result entry and an “Insert Below” button will display.
  6. Click that button and our webaddin will invoke the InsertFileAsBase64 method and, typically, an error message is displayed from that method throwing an error.

@.***

From: xiruatms @.**@.>> Sent: Thursday, June 6, 2024 10:33 PM To: OfficeDev/office-js @.**@.>> Cc: Michael Moloney @.**@.>>; Mention @.**@.>> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

@mmoloney9966https://github.com/mmoloney9966 . Considering your case might be a different issue, I would suggest you to create another github issue to make the tracking messages explicit and clear.

@AndyHorehttps://github.com/AndyHore , as I've seen you confirmed that "the initial issue is fixed", I'm going to close this issue. But feel free to create another one if you have further questions.

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2153742689, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHRRKFFE2EC7C37ASDDZGELVZAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJVGM3TIMRWHA4Q. You are receiving this because you were mentioned.Message ID: @.**@.>>

xiruatms commented 3 months ago

@mmoloney9966 , thanks for your efforts on this. Unfortunately, the user name was masked. If possible, will you please post the username/password in this form

mmoloney9966 commented 3 months ago

done

From: xiruatms @.> Sent: Monday, June 10, 2024 9:12 PM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

@mmoloney9966https://github.com/mmoloney9966 , thanks for your efforts on this. Unfortunately, the user name was masked. If possible, will you please post the username/password in this formhttps://forms.office.com/Pages/ResponsePage.aspx?id=v4j5cvGGr0GRqy180BHbR9NvrlmrippKsMvh4kTM325URVZMWjYyQTVOTVNLTUo5VzFRTTcyNU1RSy4u

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2159583171, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHUVXF7LHGYLOIHHV3LZGZFHZAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJVHE2TQMZRG4YQ. You are receiving this because you were mentioned.Message ID: @.**@.>>

xiruatms commented 3 months ago

@mmoloney9966 , thanks. I confirm I can access it now. One more question: I didn't find the attachment file you mentioned. (Might it be filtered out by github?) Another alternative: you can post the content of the xml file through the form I shared.

mmoloney9966 commented 3 months ago

Qvidian-STG1.zip

mmoloney9966 commented 3 months ago

Attached it as zip to the GitHub thread

From: xiruatms @.> Sent: Monday, June 10, 2024 9:51 PM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

@mmoloney9966https://github.com/mmoloney9966 , thanks. I confirm I can access it now. One more question: I didn't find the attachment file you mentioned. (Might it be filtered out by github?) Another alternative: you can post the content of the xml file through the form I shared.

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2159616337, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHVC3T56Z7AGNWN7JCLZGZJXBAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJVHE3DCNRTGM3Q. You are receiving this because you were mentioned.Message ID: @.**@.>>

xiruatms commented 3 months ago

@mmoloney9966 . Thanks for your help. I confirm I can see the error message now.

Just want to confirm with you: What API are you calling when "Insert Below"? I noticed that base64string was sending, but it seems insertooxml was called....

mmoloney9966 commented 3 months ago

That’s very odd. I don’t see any reference or use of the insertOoxml method in our webaddin code. Any chance that is being called within the Office JS API as part of the insertFileFromBase64 call based on the contents of the base64 or some other Office JS API call? Looks like there are only 3 possible calls our logic makes during this operation for a Word document insert.

  1. insertInlinePictureFromBase64
  2. insertHtml
  3. insertFileFromBase64

From: xiruatms @.> Sent: Monday, June 10, 2024 10:44 PM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

@mmoloney9966https://github.com/mmoloney9966 . Thanks for your help. I confirm I can see the error message now.

Just want to confirm with you: What API are you calling when "Insert Below"? I noticed that base64string was sending, but it seems insertooxml was called....

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2159665442, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHQCUON4H3EMLTB3LELZGZQATAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJVHE3DMNJUGQZA. You are receiving this because you were mentioned.Message ID: @.**@.>>

mmoloney9966 commented 3 months ago

Did you figure out the mystery of the insertOoxml call ?

From: Michael Moloney Sent: Tuesday, June 11, 2024 8:49 AM To: OfficeDev/office-js @.> Cc: Andrew Hore @.> Subject: RE: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

That’s very odd. I don’t see any reference or use of the insertOoxml method in our webaddin code. Any chance that is being called within the Office JS API as part of the insertFileFromBase64 call based on the contents of the base64 or some other Office JS API call? Looks like there are only 3 possible calls our logic makes during this operation for a Word document insert.

  1. insertInlinePictureFromBase64
  2. insertHtml
  3. insertFileFromBase64

From: xiruatms @.**@.>> Sent: Monday, June 10, 2024 10:44 PM To: OfficeDev/office-js @.**@.>> Cc: Michael Moloney @.**@.>>; Mention @.**@.>> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

@mmoloney9966https://github.com/mmoloney9966 . Thanks for your help. I confirm I can see the error message now.

Just want to confirm with you: What API are you calling when "Insert Below"? I noticed that base64string was sending, but it seems insertooxml was called....

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2159665442, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHQCUON4H3EMLTB3LELZGZQATAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJVHE3DMNJUGQZA. You are receiving this because you were mentioned.Message ID: @.**@.>>

xiruatms commented 3 months ago

@mmoloney9966 , I'm still trying to understand what's the root cause of the failure you encountered. Following are the codes ( I assumed from your addin):

async function insertDocument() { await Word.run(async (context) => { // Retrieve the source workbook. var selection = context.document.getSelection(); await context.sync(); let para = selection.paragraphs.getLast().insertParagraph("", "After"); await context.sync(); para.insertFileFromBase64(externalDoc, "Start"); //externalDoc is the base64 string from an inserted document. await context.sync(); }); }

Will you please let me know whether it's consistent with yours?

mmoloney9966 commented 3 months ago

That doesn’t line up with our logic. I ran the same test as I provided you in the same environment. Our console logging shows the final method called by our webaddin that does the insertFileFromBase64 call should be…..

async insertFileWordAfter(doc: string, asImage: boolean, asHtml: boolean) {
    const method = `${this.module}.insertFileWordAfter`;
    return Word.run(async (context) => {
        // OfficeExtension.config.extendedErrorLogging = true;
        const range = context.document.getSelection();
        context.load(range, ['paragraphs']);
        await context.sync();
        const myParagraph = range.paragraphs.getLast();
        // Now add a new paragraph...
        const nextParagraph = myParagraph.insertParagraph('', Word.InsertLocation.after);
        await context.sync();

        // New paragrpah, always blank so...
        const location: Word.InsertLocation = Word.InsertLocation.start;

        this.loggingService.logMessage(`${method}: insert with image = [${
            asImage}], asHtml = [${asHtml}], length = [${doc.length}]`);
        if (asImage) {
            nextParagraph.insertInlinePictureFromBase64(doc, location);
        } else if (asHtml) {
            nextParagraph.insertHtml(doc, location);
        } else {
            const newRange = nextParagraph.insertFileFromBase64(doc, location);
            const paragraphs = newRange.paragraphs.load('items/NoPropertiesNeeded');
            await context.sync();

            // QPA-64019 ARH 7/23/2020 - Need to remove the extra paragraph...
            const lastPara = paragraphs.items[paragraphs.items.length - 1];
            lastPara.getNext().delete();
        }

        try {
            await context.sync();
        }
        catch (error) {
            this.loggingService.logMessage(`${method}: error: ${error.message}`);
        }

        return false;
    });
}

I can’t find any “async function insertDocument” method or even any occurrence of the externalDoc parameter in your listing anywhere in our webaddin code. In the method above, the “doc” parameter is the base64 encoded string of the document being inserted.

How/where are you seeing the logic in your email?

From: xiruatms @.> Sent: Monday, June 17, 2024 4:46 AM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

@mmoloney9966https://github.com/mmoloney9966 , I'm still trying to understand what's the root cause of the failure you encountered. Following are the codes ( I assumed from your addin):

async function insertDocument() { await Word.run(async (context) => { // Retrieve the source workbook. var selection = context.document.getSelection(); await context.sync(); let para = selection.paragraphs.getLast().insertParagraph("", "After"); await context.sync(); para.insertFileFromBase64(externalDoc, "Start"); //externalDoc is the base64 string from an inserted document. await context.sync(); }); }

Will you please let me know whether it's consistent with yours?

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2172711137, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHWSFN5REGGCR4NY44LZH2O3TAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJXGI3TCMJRGM3Q. You are receiving this because you were mentioned.Message ID: @.**@.>>

microsoft-github-policy-service[bot] commented 3 months ago

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

mmoloney9966 commented 3 months ago

I did respond this past Monday to a request from xiruatms @.**@.>. He/She asked for confirmation on the code we are using and I responded that the code he listed is not the logic we have. Have not heard back since.

From: microsoft-github-policy-service[bot] @.> Sent: Friday, June 21, 2024 12:12 PM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

- Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2183043366, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHS4QH6MVPIC22USTFTZIRGGVAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJYGMYDIMZTGY3A. You are receiving this because you were mentioned.Message ID: @.**@.>>

mmoloney9966 commented 2 months ago

Just double-checking that you acknowledge we did respond to this ticket and the issue is still outstanding.

From: microsoft-github-policy-service[bot] @.> Sent: Friday, June 21, 2024 12:12 PM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2183043366, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHS4QH6MVPIC22USTFTZIRGGVAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJYGMYDIMZTGY3A. You are receiving this because you were mentioned.Message ID: @.**@.>>

xiruatms commented 2 months ago

@mmoloney9966 , thanks for checking. To avoid mistake, the codes snippet I posted were just codes I drafted to mimic your logics, not exactly the functions in your codes. The issue you reported might be a different issue. Your codes will help us to do more investigation. I will get back to you if there're any progress.

microsoft-github-policy-service[bot] commented 2 months ago

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

mmoloney9966 commented 2 months ago

This is still active and we are awaiting progress update/response from xiruatms @.**@.>

From: microsoft-github-policy-service[bot] @.> Sent: Saturday, June 29, 2024 8:02 AM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

- Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2198126795, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHWPEIFRRLHSYCI7AU3ZJ2OZVAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJZHAYTENRXHE2Q. You are receiving this because you were mentioned.Message ID: @.**@.>>

microsoft-github-policy-service[bot] commented 2 months ago

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

mmoloney9966 commented 2 months ago

Will respond next week. Currently, out of office on vacation

From: microsoft-github-policy-service[bot] @.> Sent: Wednesday, July 3, 2024 11:02 AM To: OfficeDev/office-js @.> Cc: Michael Moloney @.>; Mention @.> Subject: Re: [OfficeDev/office-js] insertFileFromBase64 does not work from a WOPI session (#1944)

This issue has been automatically marked as stale because it is marked as needing author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thank you for your interest in Office Add-ins!

— Reply to this email directly, view it on GitHubhttps://github.com/OfficeDev/office-js/issues/1944#issuecomment-2206442505, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AU5LVHV2X5JFVTU2HHTPOWTZKQG6XAVCNFSM47FSMY22U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMRQGY2DIMRVGA2Q. You are receiving this because you were mentioned.Message ID: @.**@.>>