I am trying to convert a docx file to pdf and I managed to convert the PDF to local.
The steps I followed in visual studio 2010make up
click on Add reference --> Click to COM -->select "Microsoft Word 12.0 Object Library" and cliked ok
My web configuration changed and assembly added
<add assembly="Microsoft.Office.Interop.Word, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"/>
My .cs code to convert a document to pdf is
using Microsoft.Office.Interop.Word;
protected void Page_Load(object sender, EventArgs e)
{
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; }
Everything works fine in local, but when I uploaddo it all changes to web.
Error for example
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.
. How to solve this problem?
"Microsoft Office 2010: , " , "Version = 12.0.0.0" "to" Version = 14.0.0.0 ", , , " " " → "Click to COM........"