---
title: "How to convert Word File to Rtf file format using C#"  
description: "In this blog I am trying to explain the concept of how to convert a document to rich text file format using C#. Here I am going to make a console appl"  
author: "Vijay Shukla"  
published: 2013-10-12  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/608/how-to-convert-word-file-to-rtf-file-format-using-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# How to convert Word File to Rtf file format using C#

In this blog I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to [explain the concept](https://www.mindstick.com/forum/159605/explain-the-concept-of-unique-key-violation-error) of how to convert a document to [rich text](https://www.mindstick.com/forum/33836/how-to-use-rich-text-box-editor-in-web-page) [file format](https://www.mindstick.com/forum/382/how-to-import-and-export-data-in-sql-server-from-different-file-format) using C#. Here I am going to make a [console application](https://www.mindstick.com/forum/160510/how-to-fetch-data-from-the-database-in-the-dot-net-console-application-using-c-sharp) which accept a [word file](https://www.mindstick.com/forum/159152/how-can-i-find-and-replace-text-in-docx-microsoft-word-file-using-interop) and convert in to a rtf file format.

Getting start: -

**1.** Create a console application using [visual studio](https://www.mindstick.com/articles/12378/visual-studio-for-mac-is-out-of-beta-preview-now-officially-available) with appropriate name.

**2.** Create a method with DocToRtf() name below I provide you its code.

```
private static void DocToRtf(){
     //Creating the instance of Word Application     Microsoft.Office.Interop.Word.Application newApp = new Microsoft.Office.Interop.Word.Application();
     // Give the Source file name & Target file names     object Source = "Source File Name";     // Give the Target file names
     object Target = "Target File Name";
     // Use for the parameter whose type are not known or      // say Missing     object Unknown = Type.Missing;
     // Source document open here     // Additional Parameters are not known so that are      // set as a missing type

     newApp.Documents.Open(ref Source, ref Unknown,            ref Unknown, ref Unknown, ref Unknown,
            ref Unknown, ref Unknown, ref Unknown,            ref Unknown, ref Unknown, ref Unknown,            ref Unknown, ref Unknown, ref Unknown, ref Unknown);
     // Specifying the format in which you want the output file     object format = Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatHTML;    //Changing the format of the document    newApp.ActiveDocument.SaveAs(ref Target, ref format,                    ref Unknown, ref Unknown, ref Unknown,             ref Unknown, ref Unknown, ref Unknown,             ref Unknown, ref Unknown, ref Unknown,             ref Unknown, ref Unknown, ref Unknown,             ref Unknown, ref Unknown);
       // for closing the application       newApp.Quit(ref Unknown, ref Unknown, ref Unknown);

}
```

3. Call this method in Main() method.

4. Debug the application and go to the target [file path](https://www.mindstick.com/forum/161592/how-do-you-validate-whether-a-given-path-is-a-valid-file-path-or-not) and see the result.

---

Original Source: https://www.mindstick.com/blog/608/how-to-convert-word-file-to-rtf-file-format-using-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
