Microsoft Word File Import/Export (Book)

Book tools ::: booktool_wordimport
Maintained by Eoin Campbell
Import the contents of a Microsoft Word file into a book, splitting it into chapters and (optionally) subchapters, based on the heading styles. The file can be saved from Microsoft Word, Google Docs or LibreOffice, as long as it has a '.docx' suffix. Also supports exporting books to Word format, for round-trip editing.
Latest release:
6077 sites
105 fans
Current versions available: 2

This plugin supports importing a Microsoft Word docx-formatted file as chapters to a book. The file is split into chapters and subchapters based on the built-in heading styles "Heading 1" and "Heading 2" in Word. Embedded images are also imported if they are in web-compatible format (GIF, PNG, JPEG).

It imports .docx files only, not the older .doc format.  Note that files in.docm format (i.e. including macros) are not supported.

Both GoogleDocs and LibreOffice 5.x can also save files in .docx format, and they will import too, but generally the quality is not as good as those files saved from the native Word editor, even if the document uses the same built-in "Heading 1" and "Heading 2" styles well. Your mileage may vary.

Note also that the PHP XSL extension must be enabled on your webserver, and the plugin requires Moodle 2.7 or higher.

After installation, the Book administration menu should have a new item added, similar to the screenshot below. You must create a new book, or turn on editing in an existing book, to see this menu.

Book administration menu

The plugin can also be used to export books, or chapters from books, back into Word .doc format. In general heading elements in HTML are converted back into corresponding heading styles in Word, and so on with other styles. The exported file must be opened first using Microsoft Word. You can then save it to .docx format and edit it in LibreOffice or GoogleDocs. If the exported file contains images, then you must use Word 2019 or higher, or Word 365 (web version) , in order for images to be opened correctly.


This plugin is part of set Microsoft Word file import/export.


Screenshot #0


Eoin Campbell (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS


  • Wed, Jan 6, 2016, 11:46 PM

    Hi Eoin. Thanks for sharing yet another plugin with the Moodle community. I admit I had some issues with importing a docx file with subheadings (supposed to form subchapters) and embedded image (the image did not get into the Book). But chances are that these issues were caused by the fact that I had to create the docx file in my Libre Office (not having MS Office available). Other docx file found on the internet threw a transformation exception to me.

    However, as I believe the plugin works well for you in normal situations, and because I did not spot any serious issues while checking the code, I am happy to approve this plugin now. Please find more detailed findings from the code review in your issues tracker.

    You are cleared to land, welcome to the Plugins directory.

  • Thu, Jan 7, 2016, 9:24 PM
    Hi David, many thanks for your suggestions, which I have implemented. The initial version I released didn't support splitting Word files into chapters by heading, or importing images, but both these issues are now resolved (in version 0.9.0). I will investigate support for OpenOffice files too.
Please login to post comments