Re: How can I get contents of word doc without using the clipboard by Sergio
Sergio
Wed Oct 27 10:23:07 CDT 2004
Of course it will be a little slower, so you've got to consider overall
performance too, but in my opinion much less inelegant than using the
clipboard.
The point is that the object model lets you use the Word more or less as if
your application were another user.
So, if you are Word user, what would you do to convert a document to RTF?
I've found no direct way for conversions. I would either use the clipboard
or save to a file.
In an application I would avoid the clipboard because there are too many
variables to keep under control if you want your application to be trasparent
for the user, but last choice is your...
let us know if you manage with the clipboard or you find a third way
Sergio
"Dave" wrote:
"Dave" wrote:
> Yes, I thought of that, but it would be slower, and kind of inelegant.
>
> - Dave
>
> "Sergio" <Sergio@discussions.microsoft.com> wrote in message
> news:AF7280DF-3AAE-45E3-95FD-393C326D8B1E@microsoft.com...
> > Don't know if you can get formatted text directly in RTF format.
> > But if you want to preserve the clipboard you may try to save it to a
> > temporary file in RTF format, read the file content and than delete it.
> >
> > "Dave" wrote:
> >
> > > I have a C# application that has need to open a word document by
> automating
> > > word, using COM, and extract the contents of the word document and
> insert it
> > > into a rich text box in a form. I can easily do this by having Word
> copy
> > > the contents of the doc to the clipboard, and then pasting the contents
> into
> > > the rich text box. The problem is that this trashes the previous
> contents
> > > of the clipboard in the process. I went down the road of trying to save
> and
> > > restore the clipboard, but had problems with the interaction with the
> > > "Office Clipboard". There may be a way to get that to work (saving and
> > > restoring the clipboard), but it seems like there must be an easier
> way -
> > > just extracting the contents of the word doc directly. How do you do
> that?
> > > I see the "Text" property can be used to extract the contents as plain
> ASCII
> > > text, but what if I want to extract the rich text formatted text?
> > >
> > > - Dave
> > >
> > >
> > >
>
>
>