Hi
I am trying to convert doc to pdf using the following code.
public
void
ConvertPdf()
{
object
sFilename =
"Report5.doc"
;
FromLocation = Server.MapPath(
"~/Form5/"
+ sFilename.ToString());
string
ChangeExtension = sFilename.ToString().Replace(
".doc"
,
".pdf"
);
ToLocation = Server.MapPath(
"~/Form5PDF/"
+ ChangeExtension);
//string ConvertResult = word2pdf.Word2PdfCOnversion(FromLocation, ToLocation);
Microsoft.Office.Interop.Word.ApplicationClass word =
new
Microsoft.Office.Interop.Word.ApplicationClass();
oMissing = System.Reflection.Missing.Value;
word.Visible =
false
word.ScreenUpdating =
Document doc = word.Documents.Open(
ref
FromLocation,
oMissing,
oMissing);
doc.Activate();
fileFormat = WdSaveFormat.wdFormatPDF;
doc.SaveAs(
fileFormat,
saveChanges = WdSaveOptions.wdDoNotSaveChanges;
((_Document)doc).Close(
saveChanges,
doc =
null
;}In that line doc.SaveAs, i am getting the error Command failed error. I am using microsoft visual web developer tool to develop the site.Hope this is clear. Please let me know if this is not.Thanks.