INCLUDETEXT Fields and Formatting

G

Gordon Bentley-Mix

I've not used INCLUDETEXT fields before and am trying to figure out how they
work as they appear to be a possible solution to a challenge I'm facing. I
have a source document called "source.doc" and a target document called
"target.doc". I've put in all the content I want into source.doc and
inserted a field into target.doc that looks like this:

{ INCLUDETEXT "C:\\Gordon\\Documents\\source.doc" \* MERGEFORMAT }

Works as expected; all of the content from source.doc appears in target.doc
formatted exactly as it is in source.doc - which is to say, not formatted at
all as it all uses Normal Style.

I then added some content to source.doc, saved the changes, closed the
document and updated the field in target.doc. No problems; the new content
appears in target.doc as expected.

Next I applied a bit of direct formatting (not Styles) to some of the
content in source.doc; e.g. changed the colour, made some bits bold or
italic, used a different font. Saved the changes, closed source.doc and
updated the field in target.doc. I can't be sure, but I think the first time
I updated the field, the formatting didn't come through, but after another
update or two it did. Still all good.

Finally, I applied various types of paragraph formatting. Specifically, I
applied different Styles to several paragraphs, including a numbered Style
(List Number); I changed the before and after spacing on a couple of
paragraphs; and I applied bullets to a couple of paragraphs. Saved, closed,
updated field...

Oops! The paragraph formatting doesn't come through. Actually, that's not
quite true. The numbering from the List Number Style is there but nothing
else.

Hmm... A few more little modifications to source.doc, update the field a few
more times, edit the field... Presto! Editing the field appears to have done
the trick. But why didn't just updating field work? It happily brought
through the new content and the direct font-related formatting, but not any
of the paragraph formatting and especially not the Styles. Curiouser and
curiouser...

So does anybody have any suggestions on how to make sure that the latest
content from the source document used with an INCLUDETEXT field comes
through every time? The solution I'm working on must be as reliable as
possible. The "source document" is the standard terms and conditions used in
a variety of legal documents, and it's imperative that any changes made to
the source are reflected in the target documents. Paragraph formatting -
including Styles and especially numbered Styles (used for numbering the
clauses, which are referenced elsewhere) - is critical to the integrity of
the document. INCLUDETEXT fields appear to offer a viable solution, but if
there's no easy way to ensure that paragraph formatting changes come through
I'll have to look at something else. (And I suspect that "something else"
will involve AutoText from a common "repository", and unfortunately,
infrastructure issues make this approach somewhat more difficult. ~sigh~)

BTW: This is Word 2003 running under Vista, but the actual solution will be
running under WinXP if that makes any difference.
 
P

Peter Jamieson

I can tell you a little more about what not to do than I can about what
to do.

For starters, I would
a. try using INCLUDETEXT without \*Mergeformat.

\*Mergeformat doesn't have anything to do with the formatting choices
you now have when copying text into a document (apply the styles in the
destination, retain the formatting from the source, that kind of stuff.
To be honest, I have rather lost track of what interactions occur
between INCLUDETEXT and those paste options). See below for more on
\*Mergeformat

b. only ever INCLUDETEXT bookmarked chunks. Never include a section
break or the final paragraph in the document. (I suspect that's a rule
that should sometimes be broken, though)

c. when using styles, ensure that styles with the same names are
defined the same way in both including and included documents

You may find the following quote from one of my old replies useful:

----------------------------------------------
1. with styles in general and formatting fields in particular, Word tends
to see formatting in terms of the differences between
- the styles that pertain to the text in question and
- the direct formatting you apply
So, to give a contrived example, suppose you have a subdocument with a
single paragraph containing some text and a MERGEFIELD field with no
switches. The paragraph style says "underlined", but actually you format
everything in the paragraph /except/ the field as not underlined. (OK, I
said it was contrived). Then in your mail merge main document, you
INCLUDETEXT the file in a normal paragraph with no underlining.
In this case you should not see any underlining in the output. Word
applies the style and formatting of the main document, which is not
underlined. The text in the subdocument is not underlined anyway, but in
the case of the underlined field, well, its formatting is no different
from the paragraph style. But Word isn't looking at the paragraph style,
just differences between the paragraph style and direct formatting, and
there are none in this case. So the result is not underlined. If
however, you colour the MERGEFIELD red, red will appear in the result.
What's more, there is no difference if you use \*Charformat, which is
distressing.

Actually, I don't think my description is completely accurate but the
person to ask IMO is John McGhie who probably understands these style
mixing issues better than anyone (You're more likely to find him in the
Mac Word group).
----------------------------------------------
2. In your main document, in a Normal paragraph, insert your
INCLUDETEXT field with no switches. Then change the formatting of the
field or paragraph, e.g. the font. Do you see a \*Mergeformat being
added? Maybe not, but here I do, at the moment. I can kill the
\*Mergeformat but I'm not sure how long it stays dead.

The trouble with \*Mergeformat is that
- its name isn't exactly self-explanatory, and in fact I think it's
quite misleading. I suspect a lot of people think it's kind of the
opposite of \*charformat, and applies the format of the surrounding text.
- at some point, someone in Microsoft started adding \*Mergeformat by
default to pretty well every field that anyone inserted through the user
interface. I suspect they didn't understand what it does, either. Word
Help nearly gets it right
"Applies the formatting of the previous result to the new result. For
example, if you select the name displayed by the field { AUTHOR \*
MERGEFORMAT } and apply bold formatting, Microsoft Word retains the bold
formatting when the field is updated when the author name changes."

If that's all it does, why would you need it? Why not just apply the
formatting to the field and have the result be the same as the field?
Well, one reason is that the current Help only tells part of the story.
The original Word for Windows Help (and I'm going back to my WfW1
manual) says that \*Mergeformat
"Applies the formatting of the previous result, word for word, to the
new result."
"If there is no previous result, applies the formatting of the first
character after the opening field character ({) to the result."
(I think it means the first non-blank character - in those days Word did
not insert extra space before field names).
There's more, to do with what happens if the number of words changes,
but I think it may be wrong or changed.

So \*Mergeformat is tricky, and things are likely to be even trickier
when it's applied to an INCLUDETEXT which is including a variable amount
of text.
So Word adding a sneaky \*Mergeformat isn't a great help.
 
G

Gordon Bentley-Mix

Thanks for the tips Peter. Lots of good information here, some of which I
already had an idea about but hadn't really developed a concise
understanding - especially the way Word applies formatting to field results.
Your distillation is greatly appreciated. I'll look into this more fully
when and if the need arises; the project hasn't been approved yet, much less
any decision made on the methodology.

BTW, please accept my apologies for the delay in responding. It's been one
of those weeks. ;-P
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top