Reader Level:
ARTICLE

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

On August 24, 2010 Articles | Office Development
This article shows how to convert a Microsoft Word document to other document formats such PDFs, HTML, Rich Text Format (RTF), Text, XML, xps.
  • 1
  • 0
  • 24855
Download Files:
 

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

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=59daebaa-bed4-4282-a28c-b864d8bfa513&displaylang=en

MS Office 2010

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=938fe8ad-583b-4bd7-a345-23250dc15855

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.
    1.jpg
    Sample codes attached. If you have any questions, post them below.

Article Extensions
Contents added by Dharmendra Singh on Mar 14, 2013
hi
 this project work only local host when it is uploaded on server it gives


Could not load file or assembly 'Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies

how to solve
Contents added by Suthish Nair on Mar 02, 2011
yes, referring from bin folder only. You need to add the dlls to bin folder. 
Contents added by Sunita Tajanpure on Dec 28, 2010
Does this reference to Microsoft.Office.Interop.Word or Excel refer to the GAC assembly or to the bin folder?

I want a code that should refer to the sin folder dlls not from the local system assemblies
Can anyone tell how to do this?


COMMENT USING

Trending up