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

Viewed 64124

I am trying to convert docx file into pdf and I have been successful to convert pdf on my local pc.

Steps which i have followed in visual studio 2010 is to

click on Add reference --> Click to COM -->select "Microsoft Word 12.0 Object Library" and cliked ok

My web config gets modified and added the assembly

<add assembly="Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/>

My .cs code for converting doc to pdf is

using Microsoft.Office.Interop.Word;//Name Space


protected void Page_Load(object sender, EventArgs e)//Coading on page load
{

    Microsoft.Office.Interop.Word.Application appWord = new Microsoft.Office.Interop.Word.Application();
    wordDocument = appWord.Documents.Open(Server.MapPath("~/convert/goodquest.docx"));
    wordDocument.ExportAsFixedFormat(Server.MapPath("~/convert/goodquest.pdf"), WdExportFormat.wdExportFormatPDF);
}

public Microsoft.Office.Interop.Word.Document wordDocument { get; set; }

All works fine in local but when i upload all this changes on web.

Errors such as

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

are showing up. How should i resolve this problem

I have also tried downloading "Microsoft Office 2010: Primary Interop Assemblies Redistributable" from link Here but it converted my "Version=12.0.0.0" to "Version=14.0.0.0" when i follow steps which i have told you about before as " click on Add reference --> Click to COM........"

4 Answers
Related