Board index » delphi » Memo fields and Word documents

Memo fields and Word documents

Hi All!

I have an application under development that will take files from a legacy
system and convert them to Advantage Data Systems tables.  I have the whole
thing done with the exception of a memo field in the legacy file that needs
to become a Word2000 document within the blobfield of the new table.

Don't start about why anyone would ever want to use proprietary third party
systems, etc.  I'm forced into that aspect by other development that
preceeded my own.

What is a quick and dirty way to turn a memo into a document in a blob
field?

TIA!
Tom.

 

Re:Memo fields and Word documents


Can someone take a stab at this?  I am bumping into a deadline.

Thanks!
Tom.

Re:Memo fields and Word documents


<<Tom Alexander:
Can someone take a stab at this?  I am
bumping into a deadline.

Quote

OK, here's how to do it in brief:
pop a TOleContainer on a form.
Create a new Word document in it.
Load up a TStringStream from your
blob field, insert it into the
Word document, something like this:
 Olecontainer.OleObject.content.text
   := Strm.Text;
Then save it to the blob field using
the olecontainer's SaveToStream
method.

That's off the top of my head, not
tested at all - but you asked for
speed... :)

--
Deborah Pate

Re:Memo fields and Word documents


Thanks Deborah!

I'm a relative newbie to Delphi but have twenty years of developing database
applications.  I find this implementation of the OLE container to be
frustrating beyond belief.

Can you tell me how to let the OLE container know that it is to be a new
word document?  I find no container property that seems applicable.  I can
find the Word.TWordDocument.Create from the server app.

Thanks again!
Tom.

Quote
"Deborah Pate" <d.p...@cableinet.co.not-this-bit.uk> wrote in message

news:VA.00000004.014e0eec@cableinet.co.not-this-bit.uk...
Quote
> <<Tom Alexander:
> Can someone take a stab at this?  I am
> bumping into a deadline.

> OK, here's how to do it in brief:
> pop a TOleContainer on a form.
> Create a new Word document in it.
> Load up a TStringStream from your
> blob field, insert it into the
> Word document, something like this:
>  Olecontainer.OleObject.content.text
>    := Strm.Text;
> Then save it to the blob field using
> the olecontainer's SaveToStream
> method.

> That's off the top of my head, not
> tested at all - but you asked for
> speed... :)

> --
> Deborah Pate

Re:Memo fields and Word documents


<<Tom Alexander:
Can you tell me how to let the OLE container
know that it is to be a new word document?  

Quote

Well, at design time you can just doubleclick on the
OleContainer, select Create New and then Microsoft Word
document in the list box. At run time you'd have to do
something like
  OleContainer.CreateObject('Word.Document', False);

--
Deborah Pate

Other Threads