Converting word documents and rtf files to plain text

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

Hi

I have around 150 gig of rtf and doc files I want to convert to rtf. I've
seen software packages which will do this for me, but can I use the
microsoft word objects to do it within .net?
 
and of course you can also code directly, without VSTO, if you are that sort
of developer, using the Office PIAs.

There is a SaveAs() method on the Document interface, in which you can
specify the desired output format of the document to be saved.

There is an enum called Microsoft.Office.Interop.Word.WdSaveFormat , one of
the values of that enum is wdFormatRTF , which allows you to save as RTF.

So, in VB.NET:
WordDoc.SaveAs("MyNewDocument.rtf",
Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF )

In C#, I think you will have to sprinkle a few
System.Reflection.Missing.Value in there. . .


-Dino
 
Back
Top