Convert RTF Text to Plain Text

A

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
 
C

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))
 
H

Homer J Simpson

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.
 

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