Creating a Word Document to Import
Any document can be imported as it is: it becomes an Article, its file name the title and its whole text the body. This page explains how to prepare a document so that its parts fill the fields you want, or so that it becomes an item of another class.
Name the parts of the document after fields
Each part of the document that belongs in a field gets the field's identifier as its name. When the names of the parts match the fields your site lists for a class, the document becomes that class. There are two ways to name a part:
- Sections, in LibreOffice or OpenOffice Writer: select the text and choose Insert > Section, and give the section the field's identifier as its name, for example title, intro and body.
- A paragraph style, in Word or any word processor: create a paragraph style called eZSectionDefinition. Write the identifier of the field on a line of its own in that style; the text below it, up to the next such line, goes into that field.
Save the document as DOCX, DOC or ODT. Other formats are converted on the server where it runs LibreOffice: see Setting up ezodf.
Which classes and names your site accepts
The classes an import may create and the names of their parts are set in odf.ini. The shipped settings register Article, Folder, Image, Documentation page and Blog post. For an article, the parts are title, intro, body, image, caption, publish_date and unpublish_date.
How: rebuild folders, update earlier imports, import images and files as items, and the language of the new items.
For administrators: register a class of your own
- Create the class under Setup > Classes, if it does not exist yet.
- Add it to RegisteredClassArray[] in [ODFImport].
- Add a block named after the class identifier: which field gets the title and which the body when the document names no parts, and which part names fill which fields.
- Clear the INI cache.
# settings/override/odf.ini.append.php [ODFImport] RegisteredClassArray[]=report [report] DefaultImportTitleAttribute=title DefaultImportBodyAttribute=body Attribute[title]=title Attribute[summary]=summary Attribute[body]=body
The class DefaultImportClass (shipped: article) is used when the parts match no registered class. Imported images become items of DefaultImportImageClass (shipped: image).
What can go wrong
- Everything landed in the body. The names of the parts do not match the fields of a registered class. Check the spelling: the identifier, not the field's display name.
- A field stays empty. Imports fill text lines, text blocks, rich text, dates, dates with times, images and matrices. Fill in other fields by hand.
- The look is lost. Fonts, colors and page layout are not taken over; the design of the site decides the look.
Read more
- Importing
- How do I import or export a word processor document?, in the help center.
Contributors
- Ricardo Correia
- Graham Brookins Updated Maintainer
Comments
Add a comment