This article describes the method of converting Doc documents into rtf format in C#. Share it for your reference, as follows:
First add a reference to the Microsoft Word 9.0 object library in the project reference
using System; namespace DocConvert { class DoctoRtf { static void Main() { //Create an instance of word newApp = new (); // Specify the source and target files object Source="c:\\abc\\"; object Target="c:\\abc\\"; object Unknown =; // Open the Word file to be converted (ref Source,ref Unknown, ref Unknown,ref Unknown,ref Unknown, ref Unknown,ref Unknown,ref Unknown, ref Unknown,ref Unknown,ref Unknown, ref Unknown ); // Specify the type of document object format = ; //Change the document type (ref Target,ref format, ref Unknown,ref Unknown,ref Unknown, ref Unknown,ref Unknown,ref Unknown, ref Unknown,ref Unknown,ref Unknown); //Close the word instance (ref Unknown,ref Unknown,ref Unknown); } } }
For more information about C#, please visit the special topic of this site:Summary of common techniques for C# file operation》、《Summary of C# traversal algorithm and skills》、《Summary of thread usage techniques for C# programming》、《Tutorial on the usage of common C# controls》、《Summary of WinForm control usage》、《C# data structure and algorithm tutorial"and"Introduction to C# object-oriented programming tutorial》
I hope this article will be helpful to everyone's C# programming.