combining documents; resolve conflicts

G

Guest

Hi NG,
combining word documents into a single target document can lead to a number
of conflicts of different types causing document corruption.
Some examples for conflict-prone domains are: document templates, styles,
numbering styles, bookmarks, autotexts, commandbars, and macros.

Has anybody tried to systematically resolve these conflicts?
Any experiences made?

Thanks,
Manfred
 
S

Shauna Kelly

Hi Manfred

First, I think it's worthwhile being clear about the problem.

Of the things in your list:
- document templates and autotexts cannot exist in a document

- commandbars and macros don't generally exist in a document (good practice
is to put them in a template or an add-in)

- any issue with bookmarks of the same name in different documents is easily
solved by using bookmark names unique to each document.

- there are very few problems with styles that are not numbered or bulleted,
although users often get confused. See
Why does text change format when I copy it into another document?
http://www.ShaunaKelly.com/word/styles/FormatOfTextChanges.html

So that leaves us with styles with numbering or bullets. For what it's
worth, I've never seen a case where combining documents leads to document
corruption. I have, however, seen many many cases where the formatting of
the pasted text goes awry. Most problems can be solved by (a) using Word's
built-in styles rather than custom styles and (b) where necessary, applying
ctrl-q to the pasted text.

For big jobs (eg many authors working on major publications, copying and
pasting material from several different sources) you need code that
re-creates the numbering scheme every time you open the document. That's not
a trivial thing to do.

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word


"(e-mail address removed)"
 
G

Guest

Shauna Kelly said:
Hi Manfred ...

- any issue with bookmarks of the same name in different documents is easily
solved by using bookmark names unique to each document.

- there are very few problems with styles that are not numbered or bulleted,
although users often get confused. See
Why does text change format when I copy it into another document?
http://www.ShaunaKelly.com/word/styles/FormatOfTextChanges.html

So that leaves us with styles with numbering or bullets. For what it's
worth, I've never seen a case where combining documents leads to document
corruption. I have, however, seen many many cases where the formatting of
the pasted text goes awry. Most problems can be solved by (a) using Word's
built-in styles rather than custom styles and (b) where necessary, applying
ctrl-q to the pasted text.

Hi Shauna,
thanks for your info.
And you’re right, combining documents does not lead to document corruption.
I messed things up after I had read a lot of newsgroup entries on “combining
documentsâ€, where document corruption is discussed in the context of using
Word’s subdocuments feature.
(Even the subdocuments feature can be safely used: I finally succeeded in
building a VBA application to generate document variants from
subdocument-single-sources. But this took me half a man-year, and more than a
dozen workarounds had to be implemented to stop Word from crashing and
corrupting documents).

About <combining documents>:
here are my experiences:
It was not so easy but works fine now, took me 3,5 days to produce ~500 LOC
(existing library routines not included).
The requirements were
1) Combine a header document with a free number of position documents
2) no constraints on document templates and sections (orientation!)
3) position document styles restricted to those of the header document
4) preserve fields in the documents as far as necessary.

It goes like this:
1 prepare header document:
- store as temporary document template <the template> in the local temp
folder, attach the template to the headerdoc
- use normal view, show hidden text to prevent any problems there
2 for the positiondocs in REVERSE ORDER
2.1 prepare posdoc:
2.1.1 prepare fields and bookmarks
- make bookmarks unique in the context of the headerdoc and the posdoc to
insert (new name could already be used in posdoc)
- analyze the fields: do they reference a bookmark? Do you want to keep it
or unlink it? (Some fields have to be unlinked - as document properties -
because the posdoc as context will be lost)
- unlink fields, adapt fields that reference renamed bookmarks
2.1.2 store the document in the local temp directory to avoid time-consuming
network access
2.1.3 adjust styles: attach the template, update styles, remove any style
not defined in the template
2.1.4 remove commandbars defined in the posdoc
2.1.5 remove modules defined in the posdoc
2.1.6 remove document variables defined in the posdoc
2.2 insert posdoc into the headerdoc:
- determine insertion pos, START AT THE END of headerdoc to avoid problems
with sections added
- insert section breaks if needed (depends on the section layout,
orientation of the first and last posdoc section) to keep the correct
section’s orientation
- insert the posdoc. Use InsertFile FileName:=TempDokName, Link:=True.
Without Link:=True, the posdoc’s sections will be lost (didn’t know that!!).
- unlink the includetext-field. This will also unlink any fields contained
there. You should backup the internal fields and restore them after unlinking
the includetext field (recursively!)
3 follow-up works on headerdoc:
- attach original template
- adjust added sections
4 follow-up works
- delete any temporarily used file

That’s it

Manfred
 

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