Convert Microsoft Office Word to other formats (pdf, html, rtf, xps)

This code snippet shows how to convert a Microsoft Office Word document to other document formats such 

PDFs, HTML, Rich Text Format (RTF), Text, XML, xps. We are going to use Office Interoperability for this purpose. 

Download the Primary Interop Assemblies (PIAs) from following links.

MS Office 2007

MS Office 2010

Adding the references.

  • Right click on your project.
  • Select Add Reference.
  • Go to .Net tab.
  • Select Microsoft.Office.Interop.Word from list.
    Samples attached using MS Office 2010 PIAs.
    Sample codes attached. If you have any questions, post them below.