microsoft / Office-Online-Test-Tools-and-Documentation

Office Online test tools and documentation
https://docs.microsoft.com/en-us/microsoft-365/cloud-storage-partner-program/
MIT License
233 stars 161 forks source link

Getting error while opening document or while editing via WOPI for few specific docx file #470

Closed shreyCreator closed 3 months ago

shreyCreator commented 3 months ago

I have implemented WOPI for web and it works perfectly fine in most of the cases. Also all the mandatory test cases are getting passed. But for few specific documents either i get the error Sorry , this document can not be opened for editing. or sometimes the document opens via WOPI and whenever i edit the document and close it, WOPI does not call the Post endpoint for contents basically to update the file. It directly calls the unlock endpoint so whatever changes i made in file are gone.

So when i say specific document i mean that -> There are some document where we use libre office to edit the content of docx file via code and then save it to blob storage. So only for those document i get the above issue. If the issue was with the document or it got corrupt then i should even not be able to open the file in word in local in the first place. But in local i am able to open both the files

I am adding the two files for one word editor does not even open for the other word editor opens but POST api does not get called. file-open-but-edit-unsucessful.docx wopi-server-not-opening.docx

RobRol commented 3 months ago

Hey @shreyCreator,

Thank you for sharing your challenges with the WOPI integration. In general, support is not provided in GitHub, and the CSPP Yammer Group is the recommended path to getting support for integration issues.

I should also add that I am not on the Word for the Web product team, and I am not speaking for them in this reply. However, I had a friend with deep familiarity with the Word file format look at the docx files you shared. He focused primarily on the one that wouldn't open, but there are likely analogous issues in both of them. You mentioned that these files were provided by LibreOffice. Unfortunately, it seems that in this instance LibreOffice did not output docx files that are following the published standard for the file format.

Here are two examples that were pointed out to me. The links were my own additions, but should help provide some clarity on where some of the problems with the document are.

  1. Duplicate headerReference and footerReference mentions. There are sections that contain duplicate references to the same header/footer elements.
  2. There are structured document tag nodes that have a lock child element. This isn't standards compliant. The lock needs to be a child of the structured document tag properties element.

Again, these two examples are not intended to be an exhaustive list of all standards violations in the documents you shared, but just an example of why you are encountering problems with them.

Since LibreOffice is optimized for the OpenDocument standard, have you considered trying to open your documents as ODT files in Office for the Web instead? Maybe you'll have a better experience that way.

Hope this helps provide some context on why you might be running into challenges. Please direct your future questions to the CSPP Support Channel though where more informed people can help you root cause your problems.

shreyCreator commented 3 months ago

Thank you @RobRol for the help. Appreciate it.