Copy Bookmarks to new Section

J

Jon.NET

Hello there,

I'm after some advice please.

I have a Word Template which uses a number of Bookmarks, the Template are
used to issue Notes to Customers.

The Notes could be 1 customer per page (So I'd use a Page Break), or many
customers per page (Section Break).

I've got a C# App which will Open Word, the Template, then fill in the
Bookmarks.

The Data Source is quite complex - there are 3 data sources, due to 1 - Many
relationships a particular customer has with their Notes.

What I need, on the face of it, is quite simple. I need a way to copy an
entire section, including the Bookmarks, to a new section - ready for the
next customer.

You can (as most will know) copy an entire section - but not the bookmarks,
so what I need is :

1. A way to locate bookmarks in a given section
2. Copy the entire section
3. Move the bookmarks down to the appropriate position ready for the next
customer

I've tryed doing a Mail Merge, which would be ideal, however because its
necessary to have multiple Data Sources, its not possible.

If I was doing 1 customer per document, it would be straightforward, but as
it can be more than 1 per document, its rather more complex.

I've looked at Crystal reports and other reporting tools, but need to keep
the UI as simple as possible, hence why I'm using a Word Template.

This is my first post (or at least first in a long while), so if I've got
the wrong forum please let me know.

Thank you

Jon
 
D

Doug Robbins - Word MVP

I would create a template with DocVariable fields in place of bookmarks and
use code to create an individual document from that template for each
customer. If you wanted to combine the documents, then you could unlink the
fields in the documents so that the data in them was converted to ordinary
text.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
J

Jon.NET

Ok, Thanks very much Doug,

am I right in saying you can position DocVariable fields anywhere in a
document like Bookmarks?

Thanks

Jon
 
D

Doug Robbins - Word MVP

Yes, and you can use the same DocVariable fields in multiple places in a
document. In your case however, you would want different values displayed
for the variables in the document created for each record, hence the idea of
unlinking the docvariable fields so that they are replace with the actual
values.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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