Home All Groups Group Topic Archive Search About

Convert RTF Text to Plain Text

Author
13 Feb 2006 4:12 PM
Anthony Malt
Hi,

I have written a little Windows Service which converts tons of RTF docs from
RTF to Plain Text. I using the winform rtfbox. How ever sometimes this
crahses in background.

Does anybody know a better way? 3rd Party control or what ever?

Thanks in advance
Anthony

--
Anthony Malt

Author
13 Feb 2006 9:06 PM
CMM
Total guess here... but .NET doesn't bother to do stuff like create Win32
handles and things like that until you actually *display* the window. This
poses a problem for ActiveX controls. For instance, this led to problems
with the WebBrowser control in 2003. If you instantiated a form that
contained a web browser, but kept it hidden and never showed it (like
because the user never switched to it in your "tabbed" application) it would
crash your application when you exited.

Try showing the form... possibly offscreen (.Left = 0 - .Width, etc). Then
doing the work. I'm not sure how this plays out if your app is running as a
Windows "Service." I think you can still "Show" Windows (just nobody sees
them)... but, I'm not sure about that.

As a work around... every thought of using Word to do the dirty? Word has a
very good object model which would allow you to do this (basically as simple
as wd=CreateObject (or whatever it is in .NET), wd.OpenFile(rtffile)
wd.SaveAs(textfile))

--
-C. Moya
www.cmoya.com
Show quoteHide quote
"Anthony Malt" <Anthony.M***@sterm.com> wrote in message
news:uka1LhLMGHA.3272@tk2msftngp13.phx.gbl...
> Hi,
>
> I have written a little Windows Service which converts tons of RTF docs
> from RTF to Plain Text. I using the winform rtfbox. How ever sometimes
> this crahses in background.
>
> Does anybody know a better way? 3rd Party control or what ever?
>
> Thanks in advance
> Anthony
>
> --
> Anthony Malt
>
Author
14 Feb 2006 5:22 AM
Homer J Simpson
"Anthony Malt" <Anthony.M***@sterm.com> wrote in message
news:uka1LhLMGHA.3272@tk2msftngp13.phx.gbl...

> I have written a little Windows Service which converts tons of RTF docs
> from RTF to Plain Text. I using the winform rtfbox. How ever sometimes
> this crahses in background.
>
> Does anybody know a better way? 3rd Party control or what ever?

If you have Word, why not use that? IME it will work fine and is easy to
automate.