|
|
A WordPerfect 9+ macro that inserts
multiple files (e.g., book chapters) into the current (master)
document as subdocuments.
- For more information on creating master and
subdocuments, see WordPerfect's online Help (F1 key, "Using
master documents").
- Laura Acklen wrote a tutorial, "Working
with Master Documents and Subdocuments," for the Corel
Newsletter (March
2005 edition).
- Also helpful is the section, "Working
with Master Documents and Subdocuments," in Special Edition - Using WordPerfet
12 [or Office X3] by Laura
Acklen and Read Gilgen (QUE Publishing).
|
Important notes on using
the MAKESUBS macro
- The first time you play the
macro or edit it, you will probably get a warning message about
the SortArray command being obsolete. However,
this command seems to work just fine. Just press "Continue
Compilation" if you get this warning.
- (Warnings about obsolete commands were implemented
by Corel in WP9/sp4. But even though many commands have been
named 'obsolete' by Corel since very early WP versions
probably with a view toward consistency and conservation of code
overhead most still work, and probably will work in versions
to come.)
- You should first ensure that the files
you want to include as subdocuments are all in the same folder
on your disk. This macro will process ALL files found in that
folder with the specified filename extension.
- You may want to play this macro while inside
a new, empty master document first until you see how it works.
- You may want to modify the default values
displayed on the macro's menu. You can change them in the redlined
User Modification Area of the macro's code.
- The order of files in the source directory/folder
may be different than expected due to the way Windows stores
files. Hence, you have a choice of "ascending" or "descending"
order on the menu. Try each to see which works best for your
particular setup, and set the default menu choice below. (If
you want more technical information, see the comment at the end
of this macro about FileFind, SortArray, etc.)
Notes
and tips for Master/Subdocuments
- Note that a master document contains links
(shown in Reveal Codes as [Subdoc]) to the files on disk (the
subdocuments). When the master is expanded with File, Document,
Expand Master, WordPerfect displays the subdocuments in
the master. They are still on disk as separate files. This linking
behavior is a common source of confusion. (See related tips below,
especially about working simultaneously on a master document
and one or more subdocuments.)
- Until you are comfortably familiar with the
master and subdocument feature, make extra backups. You don't
want to trash your first novel! (Even after you become familiar
with this, it is wise to make multiple backups.)
- See the Corel tutorial, "Working
with Master Documents and Subdocuments," in the Corel Newsletter
(March
2005 edition). It also contains some valuable tips, such
as these:
- "... You should always condense a master
document before you save it. Otherwise, you save the same information
twice [in the expanded master and in the subdocuments] and consume
twice the disk space. Because you've already saved the subdocuments,
you don't need to save that same information in the master document.
- If you are working in both master documents
and subdocuments [i.e., the master and one or more subdocuments
are open simultaneously in separate windows], you may run into
a situation whereby changes that you have made to a subdocument
and saved do not show up in the expanded master document. These
changes will appear in the master document only if you follow
this procedure:
- 1. Condense and save the master document.
2. Make changes to the subdocument.
3. Save and close the subdocument.
4. Open and expand the master document. [I.e., refresh the links.]
- The changes now appear in the expanded master
document. At this point, you should generate the document (Tools,
Reference, Generate) to update the index, table of contents,
table of authorities, and so forth. ..."
- Master document formatting codes apply to
subdocuments, except where codes of the same formatting type
but with different settings are found in a subdocument. In WordPerfect,
format codes take effect until replaced or discontinued, so since
subdocument codes are "downstream" from the expanded
master, they can replace earlier versions with different settings
(such as if they have a different line spacing from the line
spacing code in the master).
- If the same formatting code with the same
settings exists in both the master and the subdocuments,
it might be stripped out in subdocuments when you condense and
save the master: See Footnote 1. [Also
see the next item about styles.]
- Master document styles will override
any subdocument styles that have the same name. [This
includes the initial Open Style: DocumentStyle code that
is found at the beginning of all documents. As Noal Mellott
wrote on WordPerfect Universe: "The codes in the master
document's OpenStyle will override and overwrite all the [initial]
OpenStyle [code]s in the subdocuments when the file is generated...."]
Note that styles are like small containers, and a [Style] code
can contain other styles as well as format codes, etc., so you
should open them (double-click on the code) to see what they
might contain when setting up or formatting a master document
with subdocuments.
- Obviously, this same-name style issue can
create a problem: Some formatting in the subdocuments of a master
document can be replaced by similar formatting in the master
document's style(s), which is "upstream" from them.
Also, the entire contents of a "downstream" style's
code can be replaced by the contents of a same-name style in
the master, and will be saved with the subdocuments. (Conversely,
new styles with unique names created in subdocuments-- such as
you might create with the following tip -- are saved with the
master document. This can be handy if you add more subdocuments
later and need to apply the unique style: they will be available
to subdocuments because they will be inherited from the expanded
master.)
- Tip:
You can force subdocument formatting to "stick":
From Charles Rossiter, Corel C_Tech:
- "At the top of a sub-document, set up
your formatting as you wish. Now select all the codes (and text,
if any) that make up that formatting, and do Ctrl+C to copy to
the Windows clipboard.
- Next, do Format, Styles, Create. Name the
style.
- [Ed.: Use a unique name. For example:
_InitialChapterStyle. The Type of style should be set
to "Document (open)" so it applies to the entire subdocument.]
- Click in the style editor window and do Ctrl+V
to [paste] your chosen formatting. Save the style.
- Then whenever you first [or next] open one
of your [sub]documents, apply that [custom] style [at the top
of that document].
- [Ed.: Don't put the new custom style
inside the initial [Open Style: DocumentStyle] code
in the subdocument, for the reason given above. Just put it in
the body text area, before all other codes if possible. This
should also make them easier to find and modify
if necessary.]
- Note that by naming the style [with a leading
"_"] the style will be at the top of the style drop-down
list, making it easy and quick to select.
- If you find you need to change that [custom]
style, you can just edit it and it will automatically apply to
all documents with that style."
- Certain subdocument styles can override
master document styles -- the opposite of the previous
item.
- For example, if you used an outline style
in one or more subdocuments, and you expect the outline to increment
continuously throughout the entire (expanded) document
(and not start at "1" in each subdocument), the [Outline]
code that is inserted at the beginning of each outline can override
the normal (sequential) order of outline items. Each [Outline]
code contains a "definition" -- including numbering,
where to begin, etc.
- Solution: Expand
the master document and find the first [Outline] code. Then delete
all [Outline] codes after that one, in each of the included
subdocuments that follow this first code. By deleting all but
the first [Outline] code, the outline should be continuous through
the master document.
- When you remove a subdocument link
(shown in Reveal Codes as [Subdoc]) from a condensed
master document, the subdocument file remains on disc as a separate
file. You have simply broken the link to it from the master document.
- When you remove
a subdocument link (shown in Reveal Codes as [Subdoc])
from an expanded master document, the subdocument
file reverts to normal WordPerfect text inside the master document
-- just as though you had inserted the file into the master document
with Insert, File. It will no longer be a link to an external
(subdocument) file. Remember to save the file under a different
name to preserve the original master/subdocument format.
- [Related tip:] If you use MakeSubs.wcm to
insert multiple files and then want to turn all the files
into ordinary parts of the current document, simply place the
cursor at the very top of the expanded master document
and then
- Click Edit, Find and Replace. Place the cursor
in the Find field, and click Match, Codes.
- Scroll down in the Codes dialog to "Subdoc
Begin" and select it, then click Insert & Close.
- Click Replace All. Since the Subdoc Begin
code is part of an On/Off code pair, removing the first part
of the pair removes the second part.
- The document should now be an ordinary WordPerfect
document, not a Master document. You might need to do some reformatting
of the newly included sections.
- Remember to save the file under a different
name to preserve the original master/subdocument format.
- Use Draft view in the master document to
see the names and paths of the subdocuments. (If you don't see
the path and name, click Tools, Settings, Display, Document and
enable "Margin Icons.") Related tip: Place all
subdocuments in a folder whereby the path to that folder and
any subdocument name will not exceed 55 characters. Otherwise,
you may not see the filename.
- You can rearrange subdocuments in a condensed
master document by selecting the desired [Subdoc] code in Reveal
Codes, cutting it to the clipboard with <Ctrl+X>, and inserting
it in the new location with <Ctrl+V>. If the master document
is not condensed, select everything (for that subdocument) from
the [Subdoc Begin] code to the [Subdoc End] code, including
both of these codes, and cut/paste the material to the new location
in the master document.
- If you insert a hard page break (Ctrl+Enter)
between each subdocument code in the master -or- at the top of
each subdocument, you can force each of the subdocuments to begin
on a new page.
- Endnote placement: You can place endnotes
at the end of the entire document by placing the placement code
(using the Insert, Header/Footer dialog) at the end of the master.
Or you can place them at the end of each subdocument (be sure
to select "...restart numbering"). For this and other
reasons listed here, you might consider setting up two custom
templates for each type of project, one for a master and
one for a subdocument.
- Always place footnote or endnote option
codes (spacing, numbering method, etc.) in the master, not in
subdocuments.
- Consider setting up two custom
templates for each type of project, one for a master and
one for a subdocument.
- One handy setting that can help eliminate
the problem of accidentally deleting codes, especially when working
with master/subdocuments: Use Tools, Settings, Environment, Prompts
(tab), and enable "Confirm deletion of codes...."
- Make lots of backups when working
with master and subdocuments. The MULTISAV macro, NewFN#.wcm,
in the Library can help.
|
|
|
Footnote 1
From Using WordPerfect Office X3 by
Laura Acklen and Read Gilgen (Que, 2006):
"Automatic Code Placement (the behind-the-scenes
WordPerfect feature that positions certain codes for you) . . . can
strip out redundant codes, resulting in a subdocument that can
no longer stand on its own. For example, let's say you have a
double-spaced master document. When you expand a subdocument
with a double-spacing code in it, the Auto Line Formatter [a
component of Code Placement] strips out that code, because it's
redundant. When you save the subdocument, it is saved without
the double-spacing code so it is saved as a single-spaced document.
. . ."
So it appears that Charles Rossiter's tip
(above) about creating a new, custom
style for the top of all subdocuments is a practical solution
that will force the formatting of those subdocuments, regardless
of what happens in the master document. Your formatting should
"stick." It's a simple method, too, and relies on the
simple idea that if you set codes at the top of a document they
will be available for the rest of that document (unless replaced
or discontinued). Since styles
are like "containers," they are easily inserted where
needed, even if they contain many format codes (and even text). |