Book tools: Microsoft Word File Import/Export (Book)

booktool_wordimport
Maintained by Picture of Eoin Campbell Eoin Campbell
Import the contents of a '.docx' format file into a book, splitting it into chapters and (optionally) subchapters, based on the heading styles. The file can be from either Microsoft Word or LibreOffice. Also supports exporting books to Word format, for round-trip editing.
894 sites
898 downloads
55 fans

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. The following Word versions support this format: Word 2007, Word 2010 and Word 2013 (on Windows); Word 2011 and Word 2016 (on MacOS). Note that files in.docm format (i.e. including macros) are not supported.

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 editing an existing book on, in order 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 goal is to make books that are round-trip editable in Word, although it is not quite there yet. 

Sets

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

Screenshots

Screenshot #0

Contributors

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

Comments RSS

Show comments
  • Picture of Isabel Ashburner
    Mon, 23 Oct 2017, 7:30 PM
    Hi,
    I'm getting a similar error when I try to import my document. We're using Moodle 3.2.5. I have tried the same document on your Book Sandbox course and it worked fine (see http://www.moodle2word.net/mod/book/view.php?id=68 ) but when I use the the same file on our site I get this:

    Word import test
    Import from Microsoft Word
    Cannot read file. Either the file does not exist or there is a permission problem.

    More information about this error

    Debug info: /tempup_edMuMP.zip
    Error code: storedfilecannotread
    Stack trace:
    line 1951 of /lib/filestorage/file_storage.php: file_exception thrown
    line 1508 of /lib/filestorage/file_storage.php: call to file_storage->add_file_to_pool()
    line 145 of /mod/book/tool/wordimport/locallib.php: call to file_storage->create_file_from_pathname()
    line 140 of /mod/book/tool/wordimport/index.php: call to booktool_wordimport_import_word()

    any ideas? I'm sending this to HowtoMoodle support too (our host) so will let you know if they come up with anything.

    many thanks
    Isabel
  • Picture of Eoin Campbell
    Tue, 24 Oct 2017, 6:00 AM
    HowtoMoodle have given me a fix and I have implemented it and released version 1.2.4 which should resolve the issue.
  • Picture of Isabel Ashburner
    Tue, 24 Oct 2017, 10:37 PM
    that's great many thanks
  • Picture of Gildredge VLE Administrator
    Sat, 2 Dec 2017, 3:36 AM
    Hi. I have imported a .docx from Word for Mac 2017, and the headings, etc worked. However, I positioned images and cropped some, and these all failed. The position data is lost, whilst any cropping has been removed, so the whole image re-appears. No idea if you are able to address this, but it'd be excellent if you could.
  • Picture of Eoin Campbell
    Sat, 2 Dec 2017, 11:01 PM
    Support for images is good but not great. The image dimensions and any alternate text are retained on import, but positioning and cropping information is not. You need to do any image manipulation outside Word, and insert the final image into Word, before importing into Moodle.
  • Picture of MMT Moodler
    Wed, 27 Dec 2017, 1:51 AM
    Hello... We have installed this plugin and always get an error message, referred to the treatment of images, when we try to export a book to doc. Error messages are like:

    booktool_wordimport_base64_images: chapter file: .
    line 471 of /mod/book/tool/wordimport/locallib.php: call to debugging()
    line 109 of /mod/book/tool/wordimport/index.php: call to booktool_wordimport_base64_images()

    booktool_wordimport_base64_images: chapter file: IMG_5004 OK.jpg
    line 471 of /mod/book/tool/wordimport/locallib.php: call to debugging()
    line 109 of /mod/book/tool/wordimport/index.php: call to booktool_wordimport_base64_images()

    We have tried it in two diferents server and always the same error. We are using Moodle 3.3+ (build 20170525), Ms Word File export / import version 1.2.5 (the latest one) and PHP xsl version 1.1.28 installed and enabled.

    Thanks in advance for your time...
    Best regards.
  • Picture of Tamar Alania
    Wed, 7 Feb 2018, 8:18 PM
    Hello, when I try to export the book as word document the styles are always differently and accordingly it does not look appropriate. The exported document also does not include any images I have use in the moodle book. Is there some ways to export word document exactly like it looks in moodle?
  • Picture of Eoin Campbell
    Wed, 7 Feb 2018, 11:21 PM
    Hi Tamar,
    An exported book opened in Word will never look like the original Moodle Book. All Moodle books have the look of the theme applied to your course or site, applied via CSS styles. The Word files don't have access to these styles, so they look like ordinary Word documents. However, if you re-import the Word file back in to a Moodle Book, then the content will look as you expect again.

    If your Book has images, then you need to download a special Word template to convert the images into Word format. The template is available online at http://www.moodle2word.net/mod/resource/view.php?id=48. Unfortunately, this template contains VBA macros, and these macros trigger warnings on some virus-checking applications, and also on Windows Defender on Windows 10. To download and use it, you will have to turn off Windows Defender, and ignore any warnings.
  • Picture of meet rv
    Wed, 16 May 2018, 4:47 PM
    Curious about some feedback.

    Is this a robust plugin, does it work with 2.7 and anyt feedback/comment from anyone using it???

    -Derek
    https://www.meetrv.com/
    https://www.graysmark.co.uk/
    http://www.aeny.org/
    http://www.mugu.co.uk/
    http://www.fota.co.uk/
    http://www.clansguild.com
  • Picture of S Moodle
    Sat, 16 Jun 2018, 2:22 AM
    I understand that the import process will convert everything to the same font. Is there anyway of getting the importer to recognize some parts should be PREFORMATTED? That would be awesome since my books have many snippets of code that should be in a monospaced font.
  • Picture of Eoin Campbell
    Sat, 16 Jun 2018, 6:14 PM
    Use the “Macro Text” style in Word to create pre-formatted text in HTML. Use spaces, not tabs, for indentation, because tab spacing is lost in HTML. It might also be better to separate each line with a hard return using the + key, as paragraph spacing might be too large.
  • Picture of S Moodle
    Mon, 18 Jun 2018, 11:52 PM
    Hi Eoin,
    I have the MoodleBook Word plugin. I'm not sure where the "Macro Text" style is on that. Is this "HTML Text"?
  • Picture of Eoin Campbell
    Tue, 19 Jun 2018, 12:39 AM
    "hard return using the + key" should be "hard return using the <Shift>+<Return> key" above
  • Picture of Eoin Campbell
    Tue, 19 Jun 2018, 12:44 AM
    The "Macro Text" style is not available directly in the MoodleBook Ribbon. To get it, type <Ctrl>+<Shift>+S to open the "Apply Styles" dialog box, then type in "Macro Text in the "Style Name:" field. You can probably add this style to your Styles area if you use it a lot, or else create a shortcut key for it.
1 2 3
Please login to post comments