Office Importer Application

Last modified by Marius Dumitru Florea on 2024/07/05 14:22

x-office-document.pngImport Office documents, spreadsheets and presentations into wiki pages (most major office suite formats are supported)
TypeXAR
Category
Developed by

XWiki Development Team

Rating
3 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Compatibility
  • XWiki 1.8.4+
  • OpenOffice 3.0 or above
  • XWiki [1.8.4 - 10.11] with LibreOffice [3.6 - 6.0]
  • XWiki 10.11+ with LibreOffice 3.6+
  • The Office Importer requires a back-end Open Office or Libre Office server for its operations.
  • The Office Importer supports Office 2007 file formats only starting with XWiki version 2.2 Milestone 1.
  • The Office Importer used with Libre Office below 6.2 might led to timeouts when a TOC Macro is used (see XWIKI-16129).
  • The Office Importer below 10.11.8 with Libre Office 6.1+ won't embed the pictures when exporting the documents (see also XWIKI-16503).

Installable with the Extension Manager

Description

You should also check the Office Macro.

The Office Importer Application allows users to easily import Office documents like Word documents, spreadsheets and PowerPoint presentations into wiki pages. 

The Office Importer features include:

  • Convert existing documents into wiki pages
  • Use common office suites as wiki authoring tools

How to use

Once XWiki is configured correctly (and the Libre Office server is started), the Office Importer can be used in 2 ways.

Create Page from Office

When creating a new page fill the page name and select the special "Page from Office" page type then click on Create.

Import-Office-File-in-XWiki.png

You'll be taken to the Office Importer form where you can specify the office file to import and some options that control how the content will be imported.

Office-Importer-Wizard.png

The following fields are available:

  • Office document: allows you to upload the office document to import
  • Target page: (read-only) shows where the content will be imported
  • Overwrite existing content: shown only when the target wiki page exists already, allows you to control whether to overwrite or not its content
  • Filter styles: strip out unnecessary styling information from the result
  • Split document: create multiple pages from a single office document (based on heading levels to split)
  • Heading levels to split: choose the heading levels to split the office content on; selected heading levels and their corresponding sections will be imported in separate child pages, linked from the parent page
  • Child pages naming: shown only when the target wiki page is terminal, allows to control how the "child" wiki pages, created as a result of the split operation, are named; the following naming methods are available:
    • Heading names: the heading name is used as the page name; this option is the only one that makes sense when the target wiki page is not terminal, which is why the "Child pages naming" field is not shown in this case;
    • Main page name and heading: the heading name is appended to the name of the target wiki page 
    • Main page name and numbering: an index (counter) is appended to the name of the target wiki page
  • XWiki 14.10.2+, 15.0+ Terminal Child Pages: shown only for advanced users and only when the target page is not terminal, allows to control whether the "child" pages created by the split operation are terminal or not

XWiki 14.10.2+, 15.0+ The office document is imported asynchronously upon clicking on the Import button. A notification message shown at the bottom of the page is used to indicate the progress and the outcome of the import. I case of a successful import the user is redirected automatically to the target wiki page.

WYSIWYG Editor

The WYSIWYG editor provides two ways to import office content:

  • Select the "Import Office file" option from the + (plus) drop down on the editor toolbar:
    Import-Office-file-in-XWiki-from-WYSIWYG-editor.png
  • You can copy paste sections from an Office file directly into the rich text area. See the CKEditor Integration documentation for more information.

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). Note that installing Extensions when being offline is currently not supported and you'd need to use some complex manual method.

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions
  5. You'll also need to install all dependent Extensions that are not already installed in your wiki

The Office Importer application comes pre-bundled with XWiki versions greater than 1.8M1, so there is no need for a manual installation. The Office Importer makes use of a running Libre Office server to convert office documents into HTML before they are finally transformed into XWiki 2.0 syntax. Thus, a Libre Office server instance is required on the server computer which hosts your XWiki installation. Beginning with XWiki 1.8.4 you can configure a Libre Office or an OpenOffice server in the following ways described below.

Configuration Tutorials

  • Activating a LibreOffice server in 2 steps

Import-Office-files-in-XWiki-2-steps.gif

  • Video example of activating an OpenOffice server starting with 7.4.3 versions

If you've installed the Office Importer by installing a XAR it might happen that you've chosen options that reset Programming Rights (which are needed for this application). If this is the case you'll have to re-save the Office Importer Admin page. Go to Administer Wiki, click on the Office Server, and then change the link to : http://hostname:8080/xwiki/bin/edit/XWiki/OfficeImporterAdmin?editor=wiki. Click the Save and View button, and then try starting the server again.

Internally managed OpenOffice server process (default)

This is a very easy (and safe) option where your XWiki application takes care of managing the OpenOffice server process for you. To configure the OpenOffice server management scheme, you can use the WEB-INF/xwiki.properties configuration file:

In order to run the Office Importer configured as "Internally managed server instance" on the Windows platform you need to:

  • use a newer version of an Office application (for ex. LibreOffice 5+)
  • set openoffice.autoStart=true
  • use a similar format to this one for the homePath variable: openoffice.homePath=C:\Program Files (x86)\\LibreOffice 5
#-------------------------------------------------------------------------------------
# Settings for the OpenOffice server instance consumed by the OfficeImporter component
#-------------------------------------------------------------------------------------

#-# [Since 1.9M2]
#-# Type of the openoffice server instance used by officeimporter component.
#-# 0 - Internally managed server instance. (Default)
#-# 1 - Externally managed (local) server instance.
# openoffice.serverType = 0

#-# [Since 12.1RC1]
#-# Port numbers used for connecting to the openoffice server instance.
#-# For an internally managed server instance, it will create the process for all ports.
#-# For an externally managed server instance, only the first server port is taken into account.
# openoffice.serverPorts = 8100,8101

#-# [Since 1.9M2]
#-# If the openoffice server should be started / connected upon XE start.
#-# Default value is false
# openoffice.autoStart = false

#-# [Since 1.8RC3]
#-# Path to openoffice installation (serverType:0 only).
#-# If no path is provided, a default value will be calculated based on the operating environment.
# openoffice.homePath = /opt/openoffice.org3/

#-# [Since 1.8RC3]
#-# Path to openoffice execution profile (serverType:0 only).
#-# If no path is provided, a default value will be calculated based on the operating environment.
# openoffice.profilePath = /home/user/.openoffice.org/3

#-# [Since 1.8RC3]
#-# Maximum number of simultaneous conversion tasks to be handled by a single openoffice process (serverType:0 only).
#-# Default value is 50
# openoffice.maxTasksPerProcess = 50

#-# [Since 1.8RC3]
#-# Timeout for conversion tasks (in milliseconds) (serverType:0 only).
#-# Default value is 60 seconds
# openoffice.taskExecutionTimeout = 60000

XWiki <12.1 the property openoffice.serverPort should be used with only one value instead of openoffice.serverPorts.

XWiki <11.10.11, <12.6.3, <12.8 the default value of property openoffice.taskExecutionTimeout was 30 seconds, it has been changed to 1 min afterwards.

Default values for homePath and profilePath configuration options will be calculated based on your operating environment. Even though this is the case, this calculation might not yield accurate results for some systems. So it's a good idea to configure these values manually by editing the xwiki.properties file.

If your XWiki instance fails to automatically locate the install path of the OO server, here are some default install paths of the OO on different operating systems:

  • Microsoft Windows XP/Vista/7:

    Example for OpenOffice 3 (32-bit):

    openoffice.profilePath=C:/Users/{user}/AppData/Roaming/openOffice.org/3
    openoffice.homePath=C:/Program Files/OpenOffice.org 3

    Example for LibreOffice 3.4 (32-bit):

    openoffice.profilePath=C:/Users/{user}/AppData/Roaming/LibreOffice/3
    openoffice.homePath=C:/Program Files/LibreOffice 3.4

    Example for OpenOffice 3 (64-bit):

    openoffice.profilePath=C:/Users/{user}/AppData/Roaming/openOffice.org/3
    openoffice.homePath=C:/Program Files (x86)/OpenOffice.org 3

    Example for LibreOffice 3.4 (64-bit):

    openoffice.profilePath=C:/Users/{user}/AppData/Roaming/LibreOffice/3
    openoffice.homePath=C:/Program Files (x86)/LibreOffice 3.4
    • The example paths above are for LibreOffice 3.4.x. For LibreOffice 3.3.x you have to replace the "3.4" in the path by "3.3".
    • The correct path to the LibreOffice's executable directory should be openoffice.homePath=C:/Program Files/LibreOffice 3.4/program, but XWiki automatically adds /program to the given path for a Windows environment.
  • Ubuntu Linux (10.04):
    openoffice.homePath=/usr/lib/openoffice/
  • Ubuntu Linux (11.10):
    openoffice.homePath=/usr/lib/libreoffice/
  • Fedora:
  • Mac OSX:

    Example for LibreOffice:

    openoffice.homePath=/Applications/LibreOffice.app/Contents

If you leave your XWiki application to manage the OpenOffice server process (which is the default behaviour), your Office Importer admin UI will look something like below:

admin1.png

Externally managed (local) OpenOffice server process

This option allows you (the system admin) to control the OpenOffice server process as desired. This is very useful if you wish to customize OpenOffice server start-up parameters. You can configure this behaviour within the xwiki.properties file as shown below:

#----------------------------------------------------------------------------------
# Settings for the OpenOffice server instance consumed by the OfficeImporter component
#----------------------------------------------------------------------------------

#-# Type of the openoffice server instance used by officeimporter component.
#-# 0 - Internally managed server instance.
#-# 1 - Externally managed (local) server instance.
openoffice.serverType=1

#-# Port number used for connecting to the openoffice server instance.
# openoffice.serverPort=8100

#-# If the openoffice server should be started / connected upon XE start.
# openoffice.autoStart=false

For the profilePath configuration option, you need to have an OpenOffice profile directory created somewhere on the system. This can be a problem in server environments where launching OpenOffice is not an option. In such situations you can create an OpenOffice profile on a local computer and upload it to the server running XE.

Once XWiki is configured in this manner, an OpenOffice server must be manually started as a separate process. You can issue the following command to accomplish this:

soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard

Don't forget to replace <soffice> with the path to your OpenOffice executable. More information regarding OpenOffice server deployment is provided here. Also note that the Office Importer admin UI will change reflecting the new configuration as shown below:

admin2.png

Linux users may refer to additional installation notes here.

Auto start / Auto connect (feature)

This feature was introduced beginning with the XWiki 1.8.4 version. With this option enabled, you don't need to worry about starting / connecting the OpenOffice server from the Office Importer admin UI every time you restart XE. This option can be configured from xwiki.properties file as shown below:

#-# If the openoffice server should be started / connected upon XE start.
openoffice.autoStart=true

Dependencies

Dependencies for this extension (org.xwiki.platform:xwiki-platform-office-ui 8.3):

Get Connected