Thread: Binary data
View Single Post
  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Binary data

Your description isn't very clear, but can we assume that what you are
hoping for is that when you merge,

{ MERGEFIELD letterDoc }

will result in your "uploaded" document being inserted?

If it isn't, can you spell things out?

If it is,
a. It won't work that way. Mergefield fields can only be used to include
text, numeric and date data (in essence), not binary info. such as images,
persisted objects and so on.
b. To include images/.doc and other text files using fields during a merge,
the thing you want to include has to be in a file in the file system (and it
may need to be local or accessible via Windows networking, not any old
Internet URL), then you have to use a nested INCLUDEPICTURE field (for
images) or INCLUDETEXT field (for documents), so e.g. if you store the full
pathname of the object in letterDocPath you can use

{ INCLUDETEXT "{ MERGEFIELD letterDocPath }" }

As long as the text converter allows it, you can include part of the
document by using a "subset" name - in the case of Word documents, that
means a bookmark name, e.g.

{ INCLUDETEXT "{ MERGEFIELD letterDocPath }" mybookmark }
c. So either you
- store your documents in an accessible file system and a reference to them
in your data source, and use the above technique or
- extract the documents before you merge and insert the relevant pathnames
into your data source, and use the above technique or
- extract the documents during the merge and insert the relevant pathnames
into your data source, and use the above technique - e.g. you might be able
to do that in Access using a user-defined function and a query that
references it, or in SQL Server using a SQL Transact function. But I'm not
sure that either is a particularly way of going about things.

Alternatively, you can try to use Word's MailMerge events and VBA code to
extract the documents and insert them, or use a "one merge per data source
record" approach to do much the same - you'll find sample code for something
like that in a recent message written by me.

Peter Jamieson

"ntfirewall" wrote in message
...

Hi
Here is what I am trying,
I upload a word.doc, read using fileinputstream and store the read
buffer into the table where i have a field called letterDoc of type
binary.
When I do a ms word mail merge, i can see all the other merge fields
but the binary one is blank? any ideas how to display this binary
field. or any other method that I could use to display the doc in the
mail merge

thank you


--
ntfirewall
------------------------------------------------------------------------
ntfirewall's Profile: http://www.officehelp.in/member.php?userid=6076
View this thread: http://www.officehelp.in/showthread.php?t=1320826

Posted from - http://www.officehelp.in