A ResourceView that uses Microsoft's Doc preview
Project description
# ckanext-officedocs
This plugin provides the option of using the [Microsoft Office Web Viewer](https://www.microsoft.com/en-us/microsoft-365/blog/2013/04/10/office-web-viewer-view-office-documents-in-a-browser/) for previewing both MS Office and OpenOffice documents as an IResourceView
## Supported formats
By default, this plugin will attempt to preview the following formats:
> "DOC", "DOCX", "XLS", "XLSX", "XLSB", "PPT", "PPTX", "PPS", > "PPSX", "ODT", "ODS", "ODP"
The supported formats can be configured in your CKAN configuration file:
`ini ckanext.officedocs.supported_formats = DOC DOCX XLS XLSX XLSB PPT PPTX PPS PPSX ODT ODS ODP `
Formats are separated by spaces and matched case-insensitively. For example, to add macro-enabled Microsoft Office formats:
`ini ckanext.officedocs.supported_formats = DOC DOCX DOCM XLS XLSX XLSM XLSB PPT PPTX PPTM PPS PPSX PPSM ODT ODS ODP `
## Private package fallback
Microsoft’s online viewer can only render resources that are publicly reachable, so by default the previewer is not offered for resources in private datasets.
You can opt in to a client-side fallback for private resources:
`ini ckanext.officedocs.enable_private_fallback = true `
When enabled, private Office resources show a fallback panel instead of the online viewer:
On a Chromium-based browser (Chrome, Edge, Brave, Opera), the panel offers an “Open document” link and suggests installing an Office viewer extension ([Office](https://chromewebstore.google.com/detail/office/ndjpnladcallmjemlbaebfadecfhkepb) or [Office Editing for Docs, Sheets & Slides](https://chromewebstore.google.com/detail/office-editing-for-docs-s/gbkeegbaiigmenfmjfclcdgdpimamgkj)). With such an extension installed, opening the document renders it in the browser using the viewer’s own session, which can reach the private resource.
On other browsers (Firefox, Safari), the panel explains that previewing private files requires a Chromium-based browser with one of those extensions.
Note: browser extensions cannot be detected from a web page, so the fallback always shows the tip/link rather than auto-detecting whether an extension is present.
## Installation
To install ckanext-officedocs:
Clone this repository into the place where you normally install extensions, by default this will be /usr/lib/ckan/default/src/
Activate your CKAN virtual environment, for example:
. /usr/lib/ckan/default/bin/activate
Install the ckanext-officedocs Python package into your virtual environment:
cd ckanext-officedocs python setup.py install
Add officedocs_view to the ckan.plugins setting in your CKAN config file (by default the config file is located at /etc/ckan/default/production.ini).
If you wish for views to be created automatically for you, then you should add officedocs_view to the end of the ckan.views.default_views option in your config file.
> ckan.views.default_views = ... officedocs_view
Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:
sudo service apache2 reload
or if you're using supervisor:
sudo supervisorctl restart ckan-uwsgi:*
## FAQ
Q: It doesn't work, my documents aren't previewing
A: For the Microsoft online viewer to work, the documents to be previewed must be accessible to the wider internet (i.e. the Dataset Package is PUBLIC, not PRIVATE), and will only work if you use a hostname, and not just an IP address. To preview private resources, see the [Private package fallback](#private-package-fallback) section above.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ckanext_officedocs-1.2.0.tar.gz.
File metadata
- Download URL: ckanext_officedocs-1.2.0.tar.gz
- Upload date:
- Size: 20.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c165853831e6eb1a030a47141469f132c42400ac1b49f7579f75ca5b3bb09ada
|
|
| MD5 |
7b7a74dd75ed7c7860b3011701724063
|
|
| BLAKE2b-256 |
cd0ad5c8179c900d55d925b3697870844d98188c746e0d87512f03dc3cfbd863
|
File details
Details for the file ckanext_officedocs-1.2.0-py3-none-any.whl.
File metadata
- Download URL: ckanext_officedocs-1.2.0-py3-none-any.whl
- Upload date:
- Size: 19.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29859e486e8fca89ca6fb3e9850cf56665f6132a878953ba4246527ae33c6792
|
|
| MD5 |
9246e82e12aa19b180b2baec678ed0ff
|
|
| BLAKE2b-256 |
9de64b22da2d22a049d2efb5128b0acdb4ce49e0484b9664de7914cb982d7c83
|