Combining OpenOffice.org text documents using master files

Using OpenOffice's master documents function allows you to make page numbering consecutive and generate a table of contents. Simplify your document dealings with this tip.

I hated group projects in college.

I think most everyone did, of course. There was always one person who was a little too happy to be in charge; someone who never showed up for the meetings; and of course, someone who turned in stuff that you had to be really polite about.

More OpenOffice 2.0 tips:
OpenOffice Writer: Creating powerful lists using styles

Using styles in OpenOffice.org

Using the data pilot: OpenOffice.org Calc's answer to pivot tables 

Of course, that was the one thing most of us learned in college that prepared us for jobs: working with other people. Ya gotta do it, sometimes it sucks and there's no escaping it. (I do want to mention that, when writing the first OpenOffice.org/StarOffice book, working with my co-author Floyd was pure delight, and that the System Pod at Great Plains Software with Dan, Jax and Bill was also a kick. But not everyone is this lucky.)

One of the recurring tasks in these inescapable group projects is combining your work for the final presentation. Regardless of your job, you're going to have to take other people's work and incorporate it into your own or you're going to need to prepare your own output correctly so that it coordinates with others' work. It might be an annual economic report chock full of text, graphics and spreadsheets; it might be a huge HR manual of polices and procedures; or, if you have a really interesting job, a documented list of improprieties by the person you and the other private investigators in your firm have been tailing.

You can choose to copy and paste, or choose Insert > File, to combine the documents. But on a grand scale and with multiple authors continuing to update their content, this can cause problems. A common, reasonably workable approach is to use some sort of tool to associate the documents to make a single product. This tool makes page numbering consecutive, links the documents so that the table of contents for the whole product can be generated and makes dealing with all the documents a little easier.

Master documents are the tool you use in OpenOffice.org. Master documents have their issues but they're manageable. I'm doing two articles on this: one on how to use master documents to create a book of your text documents, and the second on how to bring in spreadsheets, graphics and other goodies into your book.

What master documents do

Master documents are essentially a sheepdog for your text documents. Master documents organize the documents, allowing you to number the pages consecutively, generate a unified table of contents and browse through the documents together without having to switch between them.

You also can use master documents to apply a template of styles, though I won't be getting into that in detail in this article. The essential value master documents provide is to create a unified whole out of many parts.

Preparing your text documents to be combined using a master document

Use paragraph styles on all the headings in your text subdocuments.This isn't absolutely necessary, but it's a really good idea. (It's kind of like how sitting down isn't absolutely necessary in order to drive a car.) Styles will let you generate the unified table of contents, do running headers and footers, cross references, change the formatting of the entire book just by modifying what the styles look like, and much more. Read these articles if you're not familiar with styles or lists.

Here's how it works. Let's say you're writing a book about dogs with three different levels in your organization. You would apply the Heading1, Heading2 and Heading3 styles as shown. (You can use different styles, even create your own, but using the existing styles is easiest.)

To apply styles, open your document, and for each heading, make sure the appropriate heading style is applied. Click somewhere in the heading, and from the dropdown list at the upper left side of the work area, select the appropriate heading style.

Creating a master document

Just choose File > New > Master Document.

It's empty except for a little Text item. (More on that later.)

That's the easy part, of course. Now you need to add something to it, because right now it's just an empty shell.

The Navigator window is what you'll be focusing on, rather than the menu bar or toolbar. The key icon for this step is the Insert icon.

Click and hold down on the Insert icon and select File.

Find the first file that you want to combine into your book.

The file will appear in the master document navigator window.

Rinse and repeat to add the other files. When you're done, it will look roughly like this.

You need to do one more thing: add a "spacer" of sorts between the files. The spacer allows you to access the files from the master document and apply styles, especially page styles. Why can't you just access the files the way you usually do? Because when you try to edit them from the master document, they're read-only. (They're still fine if you open the file directly.)

But there are some things, like styles and page breaks, that you might want to apply from the master document. So you'll want a way to access the files, to get past the read-only attributes of the files themselves.

To do this, add another one of those Text items you saw earlier above every file.

Select the first file, right-click on it, and choose Insert > Text.

Repeat until you have a Text item above all the files. The lines with an extra space above the content, in the master document itself, are what the text items look like in the file.

Tweaking pagination in your new master document

Here's what typically happens when you put your files in a master document. Headings that used to start at the top of a page don't anymore. Everything flows together. So you'll probably need to go through and put page breaks in before the first heading in each document.

One way to do this is to go to the beginning of the document, click in that blank Text item area (I told you this would come in handy).

Choose Insert > Manual Break. Click OK.

The break will appear in the document.

Another even easier way to do this is by modifying the style. (Already, applying those styles is reaping benefits.) In the master document, choose Format > Styles and Formatting. Find the Heading1 style (or whatever style is applied to the heading that you want at the top of a page) and right-click. Choose Modify.

In the style modification window, click the Text Flow tab and select Break. Click OK.

Now, everywhere that style has been applied, the heading starts at the top of a new page.

Tweaking list numbering in your new master document

You might very well have lists throughout your subdocuments. You might, for instance, have a list of procedures in one subdocument, and list of objects in another subdocument.

But once you combine documents in a master document, they're going to be part of the same big happy family. And something like this will happen -- some or all of the numbering won't restart correctly.

To make the numbering come out correctly, you need to go through the subdocuments and, wherever you need to restart numbering, click in that line and click the Restart Numbering icon.

Sadly, there is no current way to make a style that carries that RestartNumbering formatting with it. You can approach numbering from an entirely different perspective and have more control, using fields (Insert > Fields > Other), so that you don't have this manual stuff to do. But that's a huge topic for another time.

Editing files that you've put in a master document

You've got your master document all set when what happens? Charlene from New Accounts sends you a new version of her document.

What do you do? Just save the new version she sent you to the same spot as the old one, overwriting it.

What if Charlene is the lazy type and wants you to make the change for her?

If you open the master document, scroll to the content you want to change, and start typing, you'll get a big fat "I'm Sorry, I'm Afraid I Can't Do That" response from the program. The master document is for viewing, not for changing.

If you double-click the file name in the master document, the subdocument will open, and you can make any changes you want. Just save normally.

Then use the Windows menu or the task bar to switch back to the master document.

You can also just open the old file normally and make the change, saving changes.

Generating a table of contents for your whole book

Now that you have documents in your master document, and you've applied page breaks and changes as necessary, it's time to make it real by adding a table of contents (TOC).

You'll want to add the TOC to the appropriate spot. Click after your cover page, if you have one, and before or after the preface, depending on whether you have one and where you want the TOC.

Now right-click and choose Insert > Index.

In the window that appears, you don't have to do anything. You might want to change the Evaluate Down To field to 2 or 3, so your TOC isn't too detailed. And you might want to unmark Index Marks in case Charlene put some crazy stuff in her documents. Then click OK.

The TOC will appear in the master document.

Being the master of your documents

Master documents aren't without their issues. The styles in the master document can be different from those in the subdocuments. This can work for or against you, depending on what you want. If you need a style from the subdocument, just import it into the master document.

All in all, however, master documents do a decent job. If you hate your next group project, it will probably just be due to how Tony in Accounting is always late and never brings the bagels.

What other OpenOffice tips would you like to see from Solveig? Email us and let us know.

Solveig Haugland has worked as an instructor, course developer, author and technical writer in the high-tech industry for 15 years, for employers including Microsoft Great Plains, Sun Microsystems,and BEA. Currently, Solveig is a StarOffice and OpenOffice.org instructor, author, and freelance technical writer. She is also co-author, with Floyd Jones, of three books: Staroffice 5.2 Companion, Staroffice 6.0 Office Suite Companion and OpenOffice.Org 1.0 Resource Kit, published by Prentice Hall PTR. Her fourth book, on OpenOffice.org 2.0, is coming this summer. For more tips on working in OpenOffice, visit Solveig's OpenOffice blog.

This was first published in November 2006

Dig deeper on Enterprise applications for Linux

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchDataCenter

SearchServerVirtualization

SearchCloudComputing

SearchEnterpriseDesktop

Close