2

I am working on WOPI integration and I can't seem to find any workaround after an extensive research over stackoverflow.

I have implemented two endpoints in my API (.Net CORE 3.1). One is for CheckFileInfo and other is for GetFile.

I made my localhost public using ngrok. I have implemented a host page in angular which will render the iframe and load the open office document.

I am currently using the action url from test discovery XML file, provided in the official documentation at Microsoft.

When I try to open a word document using WOPI, the page gets stuck on loading only the word logo.

When tried with an excel file, I can see a blank workbook in my iframe with a prompt saying 'Couldn't open the workbook'. Same issue for PPT files too.

WOPI is not hitting my endpoint as well.

Am I missing out on any important step? Any help appreciated.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45

2 Answers2

0

Are you trying to use public office online server endpoints? These are only for registered partners (members of the cloud storage partner program). There is a "whitelist" of those, and only those are allowed to use Microsoft's public office online servers.

As far as I know, for mere mortals, there is only "on-premise" option of the office server for wopi integration. Means, you should have your own installation of the office online server.

As soon as you have that installed, there is a simple test page using which you can validate that wopi works (it is the homepage).

Am I missing something?

Nikolay
  • 10,752
  • 2
  • 23
  • 51
  • Thanks for answering @Nikolay. But I am not sure whether I need an instance of Office Online Server. Is it a mandatory thing? Right now I am trying to simply open a file in the iframe. I am using a local file to display in my webpage using Word. I have referred to such implementation [here](https://github.com/microsoft/Office-Online-Test-Tools-and-Documentation/blob/master/samples/SampleWopiHandler/SampleWopiHandler/WopiHandler.cs). – Khushbu Patel May 09 '22 at 17:28
  • For WOPI to work yes, it is a mandatory thing to have Office Online server. WOPI only works if you have it. But if you want to just show a word file, WOPI is not a way to go, there are many easier options, like google doc viewer or microsoft live viewer. Check out here: https://stackoverflow.com/questions/27957766/how-do-i-render-a-word-document-doc-docx-in-the-browser-using-javascript The problem here may be security, but it depends – Nikolay May 09 '22 at 18:02
  • For the moment I want to just view the files, but at a later stage I might want to allow editing and collaboration to my docs. However, I will try setting up OOS. Thanks! – Khushbu Patel May 10 '22 at 05:00
0

To enable the WOPI you have to have the Cloud Storage Partner Program and whitelist your WOPI host endpoints there. As well as they have some conventions for the URLs as well. You can check more from their Documentation. If you are using ngrok you have to Whitelist that URL (I don't know if they are allowed to do so). If you are trying to test it locally I am recommending to use the WOPI local Validation Tool.

For WOPI to work correctly you need to have certain endpoints to create. They are for GetFileInformation, GetFile, PutFile, and Lock Mechanism.

You don't need any Office installed in your File Server, even you can use S3 as well for your file host (I am using).

You can get more information from their documentation.