Office Macro
View office attachments (doc, ppt, xls, odt, odp, ods etc.) inside wiki pages without downloading or |
Type | JAR |
Category | Macro |
Developed by | |
Active Installs | 3 |
Rating | |
License | GNU Lesser General Public License 2.1 |
Bundled With | XWiki Standard |
Compatibility | XWiki >= 2.5 Milestone 2 |
Table of contents
Description
Displays an office file (e.g. presentation, spreadsheet or word document) within the content of a wiki page. It uses the Office Importer Application to convert the office file to HTML before displaying it.
Usage
From WYSIWYG Editor
When inserting or editing the macro call from the WYSIWYG editor there's a picker to help you select or upload the office file to view.
From Wiki Syntax
Parameters definition
Name | Optional | Allowed values | Default value | Description |
---|---|---|---|---|
attachment | no | a valid attachment reference | The name of the attachment to display. | |
reference | no | a valid resource reference or a valid attachment reference | url:) and attachments (attach:). If no reference type or an unknown reference type is provided it's parsed as attachment reference. | The reference of the attachment to display. The supported resources are URLs (|
filterStyles | yes | true/false | true | Whether to filter out all non-essential styles from the parsed content |
Examples
Displays an office attachment defined as an attachment in another page:
Configuration
XWiki 10.11.9+ You can provide a custom configuration of the office filters (documented in OpenOffice wiki) by editing document-formats.js and copying it to WEB-INF/classes.
Note that ideally you should extract that file directly from the JAR for xwiki-platform-office-importer (or xwiki-platform-legacy-office-importer) which is located in your WEB-INF/lib directory, to ensure to reuse same version of the file.
XWiki 15.9+ You don't need anymore to use a configuration containing all the filters, you can provide a configuration containing only custom filters, this file is named custom-document-formats.json.
The office macro uses the office server to convert presentation slides into images. By default these images are not very large. If you want to configure the image dimensions and other stuff you'll have to copy document-formats.js from the jodconverter jar to WEB-INF/classes and edit it. For instance, if you want the slide images to have 1024px width you have to change this line:
with
You can also control the compression level / quality of the generated images:
XWiki 15.10.13+, 16.4.4+, 16.8.0+
The conversion of presentations to images converts the presentation to PDF and then converts the pages of this PDF document to images inside XWiki as the direct conversion to images isn't supported anymore starting with LibreOffice 24.2. While the above-mentioned configuration options work, their defaults have been changed to a width of 1920 pixel and a quality of 95. Further, the settings can now be directly changed using xwiki.properties. This also allows changing the image format to PNG for lossless compression. When changing the image format to PNG, images might be quite a bit larger when the slides contain content that cannot be well-compressed by PNG like photos, so this is a tradeoff between quality and image size. The configuration options are as follows:
#-# [Since 16.8.0]
#-# [Since 16.4.4]
#-# [Since 15.10.13]
#-# The output image format to use when importing an office presentation in XWiki.
# officeimporter.presentation.imageFormat = jpg
#-# [Since 16.8.0]
#-# [Since 16.4.4]
#-# [Since 15.10.13]
#-# Quality of the output image when importing an office presentation: the quality value is between 0 and 100.
#-# Be aware that this option overrides any filter configuration provided in custom-document-formats.json for html
#-# presentations. Also this configuration is ignored if the image format is png.
# officeimporter.presentation.quality = 95
#-# [Since 16.8.0]
#-# [Since 16.4.4]
#-# [Since 15.10.13]
#-# Width of the output image when importing an office presentation: the value is given in pixel.
# officeimporter.presentation.slideWidth = 1920
Prerequisites & Installation Instructions
We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).
You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.
The OpenOffice Server needs to be configured and started in order for this macro to work. See the prerequisites for the Office Importer Application for instructions.
Dependencies
Dependencies for this extension (org.xwiki.platform:xwiki-platform-office-macro 16.9.0):
- org.xwiki.platform:xwiki-platform-office-viewer 16.9.0
- org.xwiki.rendering:xwiki-rendering-transformation-macro 16.9.0
- org.xwiki.commons:xwiki-commons-component-api 16.9.0