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.
761 sites
1k downloads
46 fans
Moodle 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4

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 Eoin Campbell
    Thu, 22 Dec 2016, 1:21 AM
    I just tested on a clean install using the default Moodle 3.2 XAMPP-based distribution with the "Base" theme, and the "Book administration" menu includes the 3 extra menu items. Note that you have to create the new book, then click "Save and Display", then click on the cogwheel icon to see the Book administration menu. Are you looking for the items in the wrong place? I certainly find the new "Base" theme very confusing.
  • Picture of avi cohen
    Fri, 7 Apr 2017, 3:26 PM
    Thank you very much for this plugin. I installed it on our test - server running moodle 3.3 . I do have a few questions or requests if you can help us.
    1. when importing a docx file. footnotes are embeded into the text which causes a lot of work.
    2. headings are nor imported (from hebrew) and are stated as index00.htm index001.html ...
    3. when docx numbered, the non-numbered front page is not imported.
    I know that this plugin is good even very good but it could become better with templating & activity set in. (could be as a sub-course) .
    Again thanks for the work
  • Picture of Eoin Campbell
    Fri, 7 Apr 2017, 10:26 PM
    Hi Avi, thanks for trying out the plugin. Here are some responses.

    1. Footnotes. What would you prefer to happen: a) footnotes are silently deleted; b) footnotes are linked, and placed at the bottom of the page, or c) footnotes are embedded where they occur (in brackets)?

    2. Headings not imported properly. This problem is caused when the default formatting of the heading is overridden. If you select the entire heading, and press +, this removes all overrides, and the heading should then import properly.

    3. First section not imported. I'll take a look at this issue.

    4. Templating and Activity. I don't know what you mean here, can you explain further? (Send me a direct message).

  • Picture of avi cohen
    Sun, 9 Apr 2017, 4:29 PM
    Thank you for the swift reply , I send in a direct message.
  • Picture of tran van dao
    Wed, 6 Sep 2017, 12:58 PM
    please!! help me!!! I can't upload file *.docx
  • Picture of Eoin Campbell
    Wed, 6 Sep 2017, 2:49 PM
    Hi Tran, the facility to upload a file is in the Book administration menu (see screenshot above). If the "Import from Microsoft Word" command is not present, then the plugin is not installed on your server. You can try it out on my test server at www.moodle2word.net too.
  • Picture of Aditya Kakodkar
    Thu, 14 Sep 2017, 5:50 PM
    Hello, We have installed the plugin but get an database SQL error as follows:
    Default exception handler: Error writing to database Debug: Incorrect integer value: '/index01.htm' for column 'importsrc' at row 1\nINSERT INTO mdl_book_chapters (bookid,pagenum,importsrc,content,title,contentformat,hidden,timecreated,timemodified,subchapter) VALUES(?,?,?,?,?,?,?,?,?,?)

    What could be the reason?

    We are using Moodle 3.1

    Thanks, in advance for all the help.

    Regards,

    Adi
  • Picture of Eoin Campbell
    Thu, 14 Sep 2017, 6:32 PM
    I think the probable reason for this error is that there is a character somewhere in your Word file that is not Unicode-compatible, and therefore the converted HTML cannot be inserted into the MySQL database. "Incorrect integer value: '/index01.htm'" is confusing me though, so it is also possibly related to a formatting problem in one of your "Heading 1"-styled headings. The headings should not have any formatting overrides applied to them. You can remove such overrides by selecting the heading and pressing <Ctrl>+<Space>.
  • Picture of Luka Torby
    Sun, 17 Sep 2017, 6:17 AM
    Hello,
    I continue to have this error:
    "You can not read the file, the file may not exist or there may be problems with the permissions"

    Can I request your help?
    Thank you.
  • Picture of Eoin Campbell
    Sun, 17 Sep 2017, 10:43 PM
    This could be anything really. Perhaps the file is not in the correct format (.docx), the filename contains forbidden characters, the file contents contains non-Unicode characters, or most likely, your Moodle installation might have temporary folders with incorrect permission settings. Try importing the file on www.moodle2word.net in the "Book Sandbox" course to rule out some of the issues.
  • 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.
1 2 3
Please login to post comments