There is no update in a week.
If there is a problem with the original code of the article on a CodeProject, it is modified and compiled.
The original Article is here
First, add a reference to the Microsoft Word 9.0 object library in the project reference.
Code:
Using System;
Namespace DocConvert
{
Class DoctoRtf
{
Static void Main ()
{
// Create a word instance
Word. Application newApp = new Word. Application ();
// Specify the source and target files
Object Source = "c: \ abc \ Source.doc ";
Object Target = "c: \ abc \ Target. rtf ";
Object Unknown = Type. Missing;
// Open the Word file to be converted
NewApp. Documents. Open (ref Source, ref Unknown,
Ref Unknown,
Ref Unknown,
Ref Unknown,
Ref Unknown );
// Specify the Document Type
Object format = Word. WdSaveFormat. wdFormatRTF;
// Change the Document Type
NewApp. ActiveDocument. SaveAs (ref Target, ref format,
Ref Unknown,
Ref Unknown,
Ref Unknown, ref Unknown, ref Unknown );
// Close the word instance
NewApp. Quit (ref Unknown, ref Unknown, ref Unknown );
}
}
}