OLEContainer + Word document + Saving to /Loading from Access Database

2004-10-07 04:16:39 PM
Hello everybody,
i'm actually trying to use an OLEContainer to use Word in my Application
(inside a form) in order to save/load documents to/from a database
my algo is:
onshow: opening the ole object
... (type my document)
create a memorystream ms
save olecontainer to stream ms
load my query param from ms stream
execute my query
create a memorystream ms
create a adoblobstream adobs using the blob content from the current
record in read mode
seek for the true begining of the word document (seem that access add
some header to the blob document according to this:
delphi.about.com/library/weekly/aa030601a.htm if you create the
blob doc from access)
copy the remaning stream from adobs to ms
load olecontainer from stream ms
but I get some problems:
1- I get an error when loading the stream into olecontainer: Invalid
Stream Format. even if i use the begining of the blobfield instead of
searching for the doc begining.
2- i try to save directly the olecontainer to file using the method
savetofile and load it using loadfromfile, i get the same error
i think i miss someting in my algo, but I am not an OLE pro so i don't
know what is my error
someone can explain me the basic of loading ole document from stream and
saving it to stream ?