Binary data

N

ntfirewall

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

thank yo
 
P

Peter Jamieson

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
 
N

ntfirewall

Thanks Peter for your reply.

i am trying this but it does not work still.

Error! Not a valid filename.
INCLUDETEXT "C:\\ChambersMcClay\\Documents\\InsRequestLetters\\
MERGEFIELD ErrorDocFileName }.doc
 
P

Peter Jamieson

Do you have a space before the C: ? (That's a common problem!)

What is the result of { MERGEFIELD ErrorDocFileName } ?


Peter Jamieson
 

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