Office Online Server

In Seafile Professional Server Version 4.4.0 (or above), you can use Microsoft Office Online Server (formerly named Office Web Apps) to preview documents online. Office Online Server provides the best preview for all Office format files. It also support collaborative editing of Office files directly in the web browser. For organizations with Microsoft Office Volume License, it’s free to use Office Online Server. For more information about Office Online Server and how to deploy it, please refer to https://technet.microsoft.com/en-us/library/jj219455(v=office.16).aspx.

Notice: Seafile only supports Office Online Server 2016 and above.

Seafile’s own Office file preview is still the default. To use Office Online Server for preview, please add following config option to seahub_settings.py.

  1. # Enable Office Online Server
  2. ENABLE_OFFICE_WEB_APP = True
  3. # Url of Office Online Server's discovery page
  4. # The discovery page tells Seafile how to interact with Office Online Server when view file online
  5. # You should change `http://example.office-web-app.com` to your actual Office Online Server server address
  6. OFFICE_WEB_APP_BASE_URL = 'http://example.office-web-app.com/hosting/discovery'
  7. # Expiration of WOPI access token
  8. # WOPI access token is a string used by Seafile to determine the file's
  9. # identity and permissions when use Office Online Server view it online
  10. # And for security reason, this token should expire after a set time period
  11. WOPI_ACCESS_TOKEN_EXPIRATION = 30 * 60 # seconds
  12. # List of file formats that you want to view through Office Online Server
  13. # You can change this value according to your preferences
  14. # And of course you should make sure your Office Online Server supports to preview
  15. # the files with the specified extensions
  16. OFFICE_WEB_APP_FILE_EXTENSION = ('ods', 'xls', 'xlsb', 'xlsm', 'xlsx','ppsx', 'ppt',
  17. 'pptm', 'pptx', 'doc', 'docm', 'docx')
  18. # Enable edit files through Office Online Server
  19. ENABLE_OFFICE_WEB_APP_EDIT = True
  20. # types of files should be editable through Office Online Server
  21. # Note, Office Online Server 2016 is needed for editing docx
  22. OFFICE_WEB_APP_EDIT_FILE_EXTENSION = ('xlsx', 'pptx', 'docx')
  23. # HTTPS authentication related (optional)
  24. # Server certificates
  25. # Path to a CA_BUNDLE file or directory with certificates of trusted CAs
  26. # NOTE: If set this setting to a directory, the directory must have been processed using the c_rehash utility supplied with OpenSSL.
  27. OFFICE_WEB_APP_SERVER_CA = '/path/to/certfile'
  28. # Client certificates
  29. # You can specify a single file (containing the private key and the certificate) to use as client side certificate
  30. OFFICE_WEB_APP_CLIENT_PEM = 'path/to/client.pem'
  31. # or you can specify these two file path to use as client side certificate
  32. OFFICE_WEB_APP_CLIENT_CERT = 'path/to/client.cert'
  33. OFFICE_WEB_APP_CLIENT_KEY = 'path/to/client.key'

Then restart

  1. ./seafile.sh restart
  2. ./seahub.sh restart

After you click the document you specified in seahub_settings.py, you will see the new preview page.

office-web-app

Trouble shooting

Understanding how the web app integration works is going to help you debugging the problem. When a user visits a file page:

  1. (seahub->browser) Seahub will generate a page containing an iframe and send it to the browser
  2. (browser->office online server) With the iframe, the browser will try to load the file preview page from the office online server
  3. (office online server->seahub) office online server receives the request and sends a request to Seahub to get the file content
  4. (office online server->browser) office online server sends the file preview page to the browser.

Please check the Nginx log for Seahub (for step 3) and Office Online Server to see which step is wrong.

Notes on Windows paging files

You should make sure you have configured at least a few GB of paging files in your Windows system. Otherwise the IIS worker processes may die randomly when handling Office Online requests.