Some days ago, a friend of mine asked me how to convert doc to rtf in c#. After replied him, it occurs to me that this matter maybe perplex our other friends. So I put an article here for you to share. In this article, I will show you how to convert doc files to rtf files in batch together with the c# application.
I shoot the conversion by a software named VeryDOC doc to any converter which can do the conversion as its name implies. It can be used to do batch conversion from DOC, DOCX, DOCM, RTF, TXT, PPT, PPTX, XLS, XLSX, OpenOffice ODT, HTML, MHTML files to PDF, Postscript, PS, EPS, SVG, SWF, XPS, PCL, HPGL, HTML, MHTML, RTF, Text, XML, JPG, TIFF, EMF, WMF, BMP, GIF, PNG, TGA, PCX, etc. So converting doc to rtf is just a piece of cake for this software. If you are interested in this software, you can have a free try and download it here:https://www.verydoc.com/doc-to-any.html
Same with the other command line software, doc to any command line also needs run in the MS-DOS Windows. When you use it together with c#, you can call it like the following code.And Please make sure that of the PROCESS class available in SYSTEM.DIOGNOSTICS namespace.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Process proc = new Process();
proc.StartInfo.FileName = @"C:\\doc2any.exe";
string strArguments = "";
strArguments += " D:\\temp\\sample.doc D:\\temp\\out.pdf";
Console.WriteLine(strArguments);
proc.StartInfo.Arguments = @strArguments;
proc.Start();
proc.WaitForExit();
}
~~~~~~~~~~~~~~~~~
And the command you should input in the Dos Windows is like: doc2any.exe -wtext "VeryPDF" "C:\in.doc" C:\out.rtf. If you need to adjust the converted file, please input the corresponding parameters referring to the “readme.text” .
When you need to convert doc to rtf file, you can directly change the expanded-name in the word document. Save the doc file as rtf file. But my friends need to convert the file format in c#, so I recommend him to use this software.
If you have any question about file formats converting or our software, you can come to our live chat or email us to support@verydoc.com. Then we will solve your matters at once.