How to get Word document as stream?

K

Kertész László

Hi,

I have a cgi, that must send back a word document. How can I get the content
of a Word document as a stream, to send back to the caller,
without saving it and sending the saved document file? I tryed
Document.Content, but it is a range object, not the content itself.

thanks,
Laszlo
 
M

Marty Lee

Howdy Laszlo,

The answer depends in part on what kind of content you
want to return to the user. Assuming that the Word
document only contains text and that you have a utility
called InterfaceCGI to stream text characters "back to the
caller" then the following might work:

Sub StreamCharacters()

Dim rngChar as Range

For each rngChar in ActiveDocument.Characters
' InterfaceCGI sends a character back to caller,
' rngChar.Text provides that character.
InterfaceCGI rngChar.Text
Next rngChar

End Sub

I'm not certain how this will be affected by header/footer
stories, indices, TOCs and other real-world complications
that a Word document might contain.

Marty
(My email should be msn, not "nsm". Forgive the small
corruption as it is useful in avoiding spammers)
 

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