Correct use of \* mergeformat? Has it changed in Word 2007?

L

LurfysMa

What is the exact function of the " \* MERGEFORMAT" switch and when
should it be used and when not?

According to the 2007 help:

If you update a field, any formatting that you applied to the field
results may be lost. To retain the formatting, include the \*
MERGEFORMAT switch in the field code. When you insert fields by using
the Field dialog box, the \* MERGEFORMAT switch is included by
default.

What formatting are they talking about that may be lost?

How will the field behave differently with or without this switch?

Can you provide some examples?
 
L

LurfysMa

What is the exact function of the " \* MERGEFORMAT" switch and when
should it be used and when not?

According to the 2007 help:

If you update a field, any formatting that you applied to the field
results may be lost. To retain the formatting, include the \*
MERGEFORMAT switch in the field code. When you insert fields by using
the Field dialog box, the \* MERGEFORMAT switch is included by
default.

What formatting are they talking about that may be lost?

How will the field behave differently with or without this switch?

Can you provide some examples?

After some more research, it appears that the mergeformat switch
should be replaced by the charformat switch. But I cannot find a good,
clear definition of these two switches anywhere.

Can someone provide a complete and succinct description of these two
switches and compare their functions?
 
G

Guest

Hi LurfysMa,

As far as I understand it ...

(Many) word fields have two views - "code view" where you see the field
definition (the curly brackets and stuff), and "result view" where you see
the value the field acquired the last time it was updated.

The MERGEFORMAT switch works something like this: if you update a field and
then apply formatting to the field *result* (not to the field code), that
formatting should be retained the next time the field is updated. If you
don't use the MERGEFORMAT switch, formatting that you apply to the field
result may not be retained when the field is next updated.

The CHARFORMAT switch works something like this: if you apply formatting to
the first character of the field type (e.g. to the "A" in an AUTHOR field) in
*code view* (not in result view) that formatting should be retained when the
field is next updated.

One way to see for yourself what's going on with MERGEFORMAT is to insert an
AUTHOR field in a document, update the field, apply, for example, bold, to
the first name, change the author (in File>Properties or Office
button>Prepare>Properties) and update the field again. And try the same thing
with names of varying lengths. If you apply the formatting to varying parts
of the field result you may find that you get unexpected results.

So in theory, CHARFORMAT enables you to control the format of a field's
result for all future updates, and MERGEFORMAT enables you to apply a format
to a field result, on the fly as it were, and have that newly-applied format
carried through to future updates of the field.

However, because of the unexpected nature of the results you get depending
on which bits of a field result you apply formatting to, and how the value of
the field may change with subsequent updates, I don't find the MERGEFORMAT
switch to be very reliable. In fact, I've never had a real-world occasion
where I've had to use it.

And because of its behaviour, it can lead to problems such as parts of text
in the results of, for example, a MERGEFIELD acquiring a format that they
shouldn't have. Another reason why I avoid them and why I've never understood
why the "Preserve formatting during updates" tick box in the field insertion
dialog (which inserts the switch) is selected by default for a lot of fields.

Hope this isn't too unclear.

Regards.

Ed
 

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