Document to BLOB

  • Thread starter Thread starter Christopher Weaver
  • Start date Start date
C

Christopher Weaver

Anyone have any examples of writing the contents of a document (Word or
whatever) out to a BLOB field? I could take it from a file but I would also
like to know how to grab it from the application itself, which I believe
would entail opening the document editor within my app.
 
Christopher,

I don't know of many applications that support this. Word doesn't
support this directly. I believe you could probably get the IPersistMemory
interface (a COM interface) from the Document object in word and then get
the bytes from there, but ultimately, that is a waste, to load the
application and have it spit out the bytes to you, when you can just read it
to disk.

A blob field will be represented as a byte array in .NET in the data
set, so all you would have to do is load the contents into a byte array, and
assign it to the blob field in the data set. The data adapter will worry
about the rest.

Hope this helps.
 
Thanks. That's exactly what I needed to know.


Nicholas Paldino said:
Christopher,

I don't know of many applications that support this. Word doesn't
support this directly. I believe you could probably get the
IPersistMemory interface (a COM interface) from the Document object in
word and then get the bytes from there, but ultimately, that is a waste,
to load the application and have it spit out the bytes to you, when you
can just read it to disk.

A blob field will be represented as a byte array in .NET in the data
set, so all you would have to do is load the contents into a byte array,
and assign it to the blob field in the data set. The data adapter will
worry about the rest.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Christopher Weaver said:
Anyone have any examples of writing the contents of a document (Word or
whatever) out to a BLOB field? I could take it from a file but I would
also like to know how to grab it from the application itself, which I
believe would entail opening the document editor within my app.
 
Back
Top