Use master documents
Creating and using master documents in OOoWriter 1.1
Note: Much of the information on this page is out of date. OOoWriter now has features that make this process much easier. I will revise this page when I have time.
This page is an excerpt from Taming OpenOffice.org Writer (no longer available). A variation of this material is in OpenOffice.org Writer: The Free Alternative to Microsoft Word.
Yes, master documents do work in OpenOffice.org Writer. However, you need to have a very disciplined approach to make sure they work correctly and reliably. This topic describes the steps to take. Be sure to do steps 1 through 5 in the order given here.
Although you can make changes at most steps in this process, the more you can plan before you start, the less work you’ll have to do to correct any problems later. Here are some things you need to plan:
- Parts of book or report required, and the page numbering to be used in different parts of the book. I will use as an example a book with these parts:
- What pages will be in the master document and what will be in the subdocs. The ToC and Index must be in the master document. A typical arrangement would be:
- Page, paragraph, character, frame, and numbering styles. Some styles for my example book are:
- Fields and AutoText entries as required.
|Title (cover) page||1 page||no page number|
|Copyright page||1 page (back of title page)||no page number|
|Table of contents||unknown length||start with i|
|Preface (Foreword)||2 pages||continue from ToC|
|Chapters 1 to 8||unknown length||start with 1|
|Appendixes A, B||unknown length||continue from Chapter 8|
|Index||unknown length||continue from Appendix B|
|Title (cover) page||In master document|
|Copyright page||In master document|
|Table of Contents||In master document|
|Chapter 1 to 8||Subdocuments|
|Appendixes A, B||Subdocument|
|Index||In master document|
|Name||Characteristics||Next page style|
|Title page||No header, footer or page numbers; layout different from other pages||Copyright page|
|Copyright page||No header, footer or page numbers; layout different from other pages||Front matter first page|
|Front matter first page||No header; page number in footer, Roman numbers (i, ii, iii); layout different from following pages||Front matter page|
|Front matter page||Header and footer, one containing the page number (Roman); mirrored layout||Front matter page|
|First page||No header; page number in footer, Arabic numbers (1, 2, 3); layout same as Front matter first page||Body page|
|Body page||Layout as for Front matter page, but Arabic page numbers|
Use Heading 1 for Chapter titles. Define a heading level to use for Appendix titles. A handy style is Page Break, defined as 6 pt, no space before or after, page break before. Others: whatever suits your requirements.
You can create your template from an existing document or template that contains some or all of the styles you want for this document, or you can create the template from a blank document. If you use an existing document or template, I recommend that you delete all the text from it except for fields in headers and footers before saving it as the template for this project. It will still have all the styles you defined, even if the text is not there.
Be sure to use File > Templates > Save when creating the template. You can change the styles in the template as your project develops.
If you are starting a new project, you must ensure that you create the master document and all the subdocuments from the same template. It doesn’t matter what order you use to create the master and subdocuments, and you don’t have to create all the subdocuments at the same time, when you’re starting the project. You can add new subdocuments at any time, as you need them, as long as you always create them from the same template.
Create the master document
I recommend you follow this process to create the master document. You can use other methods, but each method (including this one) has its drawbacks.
- Open a new document from the template you created in Step 2. Be sure the first page of this new document is set to the page style you want for the first page of the final document; if it isn’t, change it. In our example, the style for the first page is Title Page.
- If any text or page breaks came into this document from the template, delete the text. (Fields in headers and footers can stay.)
- Click File > Send > Create Master Document. Save the master document in the folder for this project, not in the templates folder. We’ll return to this master document later. For now, you can either leave it open or close it, as you prefer.
A subdocument is no different from any other text document. It becomes a subdocument only when it is inserted into a master document and opened from within the master document. Some settings in the master document will override settings in a subdocument, but only when the document is being printed or otherwise manipulated by the master document.
Create a subdocument in the same way as you create any ordinary document:
- Open a blank document based on the project template (very important).
- Delete any unwanted text, and set the first page to whatever page style you specified for the first page of a chapter.
- Click File > Save As. Give the document a suitable name and save it in the folder for this project.
If you already have some of the chapters written, the files are probably not based on the template you just created for this project. You will need to change the template attached to the existing file. The only way to do this is:
- Open a blank document based on the project template.
- Copy the contents of the original document into this new document.
- Click File > Save As and save the new document in the project folder under a suitable name.
- Rename the original chapter file so you don’t use it by mistake.
The instructions in this step use the page numbering requirements given in Step 1. If your book has different requirements, change these instructions to suit.
These instructions are fairly tedious, but once you have the master document set up, you shouldn’t have to change it, and with a bit of practice setting it up goes quickly.
- Open the master document. Make sure paragraph marks, text limits, and sectiion limits are showing. (If necessary, set them in Tools > Options > Text Document > View, or click the Nonprinting characters icon.) Display the Navigator (click Edit > Navigator, or press F5, or click the Navigator icon).
- Type the contents of the title page (or leave placeholders and fill in later). With the insertion point in the last blank paragraph on the page, click Insert > Manual Break. On the Insert Break dialog (Figure 1), select Page break and the page style for the second page (Copyright page in our example), and leave the Change page number checkbox deselected. Click OK.
Figure 1. Inserting a page break between the title page and the copyright page
- Type the contents of the copyright page (or leave placeholders). Insert another manual page break, this time setting the page style to Front matter first page. Select the Change page number checkbox and choose 1 in the box below that, as shown in Figure 2. This number 1 will show in your document as i, because the page style is defined to use Roman numerals.
Figure 2. Inserting a page break before the first page of the front matter
- Let’s assume the third page is for the Table of Contents. Leave a blank paragraph or two on this page and insert another page break, with next page again set to the Front matter first page style, which we want to use for the first page of the Preface. Because we want the page numbering for the Preface to continue from the page numbers of the Table of Contents, we do not select the Change page number checkbox this time. Notice that the Navigator shows one item, labelled Text.
- At last we’re ready to add the first subdocument, which is the Preface. On the Navigator, select Text, then long-click on the Insert icon and click File.
Figure 3. Inserting a subdocument into a master document using the NavigatorA standand File Open dialog will appear. Select the required file (which you created in Step 3) and click OK. Wait while OOo loads this document.You’ll see that the inserted file is listed in the Navigator before the Text item, as shown in Figure 4. You do not want it there; you want it after the text. Select Text and click the Move Up icon.
Figure 4. Moving text to before a subdocument
Check whether the first page of the master document has the correct page style. If not, change it.
Scroll to the place where the subdocument begins. You’ll see that it has a blank paragraph at the top of the page; this was inserted as part of the manual page break. Set this paragraph to the PageBreak style you created in Step 2.
Figure 5. Page break before subdocument, which is in a protected section
You’ll also notice that the document you just inserted is in a protected section. That means you can’t change any of the contents of this subdocument from within the master document. See Step 6. Update subdocuments as needed.
- Save the master document file before you do anything else.Now you want to add the next subdocument, which in our example is Chapter 1. In the Navigator, select the Preface file you just inserted. Long-click on the Insert icon and click File. Select the required file for the first chapter and click OK. Wait while OOo loads the file.You’ll see that it comes into the master document before the Preface, which again is not what you want. Select the new file and click the Move Down icon to move the new file to be after the Preface.
- Now place the cursor in the master document itself and scroll around until you find the beginning of Chapter 1. You’ll find that it is on the same page as the end of the Preface, and you’ll probably find there is no paragraph marker between the section markers for the end of the preface and the beginning of the chapter, so you can’t insert a page break.
Figure 6. Two sections of a master document with no text area between themTo fix this, go back to the Navigator. Select the last file in the list (which should be Chapter 1), then long-click on Insert and click Text. A blank paragraph appears in the master document between the two section marks. Click on this blank paragraph and insert a page break, specifying the First Page style and the page number to start at 1. Click OK.
Figure 7. A text area between two sections of a master document
- Save the master document again.Now go back to the first page of the Preface and check whether its page style is correct. (It may go wrong when the chapter is inserted.) If the page style is wrong, change it to the correct style (Front matter first page in our example).
- To insert Chapter 2, go to the Navigator and select the last item on the list, which should be Chapter 1. Insert the file for Chapter 2, move it to the end of the list, and insert a page break as described earlier. Repeat until all the subdocuments have been added to the list.
The Navigator will now look something like Figure 8.
Figure 8. The Navigator showing a series of files in a master document
- You can define your Heading 1 paragraph style to start on a new page, and thus avoid inserting manual page breaks between chapters, but this causes a page numbering problem if you want to restart page numbering at the beginning of Chapter 1. To restart page numbering, you must insert a manual page break; but because the Heading 1 style on the first page of Chapter 1 forces yet another page break, you end up with one or more unwanted blank pages before the first page of Chapter 1. The technique described in this chapter avoids this problem.
You can generate a table of contents, bibliography, or index for the book, using the master document. You must insert these items into a text section in the master document.
Put the insertion point on the page in the first text section, where the table of contents is to go. Create the table of contents.
If you do not have a Text section at the end of the master document, insert one before the last subdocument, then move it down so it is after the last subdocument. Now, if you have included bibliographic entries in your subdocuments, you can put the insertion point on the page in this last text section, where the bibliography is to go. Create the bibliography.
If you have included index entries in your subdocuments, put the insertion point on the page in the last text section where the index is to go. Create the index.
You cannot update a subdocument from within the master document. Instead, you must open the subdocument, either by double-clicking on it in the master document’s Navigator, or by opening it from outside the master document. Then you can edit it just as you would edit any other document. Just one rule: if you make any changes to the styles while editing a subdocument, you must copy those changed styles to the template so they are available to all of the subdocuments and to the master document.
You can change the styles in the template as your project develops.
To update the master document (and all of the subdocuments) with changes to the template, just open the master document. You’ll get two messages: first, to ask if you want to update all links; and second, if you want to apply the changed styles. Answer Yes to both of these messages.
If you’ve changed the contents of any subdocument, you’ll need to manually update the table of contents, bibliography, and index from within the master document.