Bookmarks example


#1

Don’t seem to find an example of using Bookmarks rather than Merge Fields. Your documentation says that they are supported. It is necessary for us to resolve this issue ASAP.<?xml:namespace prefix = o ns = "urnTongue Tiedchemas-microsoft-comSurprisefficeSurpriseffice" /><oStick out tongue></oStick out tongue>

<oStick out tongue> -----------------

To insert data at bookmarks you need to use DocumentBuilder.MoveToBookmark and then other DocumentBuilder methods to insert content.<oStick out tongue></oStick out tongue>

MailMerge.Execute can only be used with merge fields.<oStick out tongue></oStick out tongue>

</oStick out tongue>

#2

Thanks for your response. We still would like to have some code samples using bookmarks. We have not being successful with the MoveToBookmark – builder.write thing.<?xml:namespace prefix = o ns = "urnTongue Tiedchemas-microsoft-comSurprisefficeSurpriseffice" /><oStick out tongue></oStick out tongue>

In addition, we are having a difficulty opening multiple word documents (even using merge fields) with multiple records from the same data source (depending on a few conditions). I realize that filtering could be an option, however, we would not know what to filter until we read the whole data source anyways. Any ideas? We will love a sample of your product resolving a similar situation.<oStick out tongue></oStick out tongue>

<oStick out tongue></oStick out tongue>

The fact of the matter is, we have purchased 2 enterprise licenses for 2 <?xml:namespace prefix = st1 ns = "urnTongue Tiedchemas-microsoft-comSurprisefficeTongue Tiedmarttags" /><st1:country-region wTongue Tiedt="on"><st1Stick out tonguelace wTongue Tiedt="on">US</st1Stick out tonguelace> government clients in 2 separate states, which have a heavy investment in documents with bookmarks and refuse to change them to Merge Fields and that currently produce multiple word documents from the same data source in the fly from selection screens.<oStick out tongue></oStick out tongue>


#3

Here is an example how to use bookmarks:

Word word = new Word();
Document doc = word.Open(“myfile.doc”);
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark(“Target1”);
builder.Write(“Anything”);
doc.Save(“myfile out.doc”);

I’m not exactly sure of of your requirements and the problems you think you are facing.

Just open the document, create a document builder for the document, move to the bookmark, insert your data, save the document.

Since you are using bookmarks, not mail merge, all data selection, filtering, iteration over rows you need to write youself. It’s not a big deal usually and in fact, often leads to better performance during data population as mail merge tends to be a little slower. I recommended using bookmarks instead of merge fields to once client where it was very performance sensitive.


#4

Never mind. Some better-no-say-what-I-think-about person created the document using Word 97, and when updated utilized word 2003. I will take the issue with Microsoft in Redwood about “portability” and “downward” compatibility.<?xml:namespace prefix = o ns = "urnTongue Tiedchemas-microsoft-comSurprisefficeSurpriseffice" /><oStick out tongue></oStick out tongue>

<oStick out tongue> </oStick out tongue>Our documents work now.<oStick out tongue></oStick out tongue>

<oStick out tongue> </oStick out tongue>I have coded a component to print automatically, but look forward to your release for the component.<oStick out tongue></oStick out tongue>

<oStick out tongue> </oStick out tongue>Thanks for the support,<oStick out tongue></oStick out tongue>

<oStick out tongue> </oStick out tongue>Ed<oStick out tongue></oStick out tongue>

<oStick out tongue> </oStick out tongue>