locked
Using Word component from ASP.NET page question RRS feed

  • Question

  • User-997327765 posted

    I've an ASP.NET page to convert local .doc file to pdf using Word 2007. The code runs fine running within VS.NET. It was giving COM error 80070005 running using IIS instead VS.NET but I managed to fix it using DCOMCNFG and adding ASPNET user to it. The problem is the code now comes to a stop while opening the .doc file. It doesn't give any exceptions, it doesn't seem to timeout, it just waits there. Can you give me any ideas what's wrong? The code stops at this .Open() line :


    ApplicationClass app = new ApplicationClass();
    object missing = System.Reflection.Missing.Value;
    object file = @"c:\test\test.doc";
    object f = false;
    object t = true;

    doc = app.Documents.Open(ref file, ref missing, ref f, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref f, ref missing, ref missing, ref missing, ref missing);

    object FileName = @"c:\test\word2pdf.pdf";
    object FileFormat = WdSaveFormat.wdFormatPDF;
    object Encoding = MsoEncoding.msoEncodingEBCDICEnglish;
    object LineEnding = WdLineEndingType.wdCRLF;

    doc.SaveAs(ref FileName, ref FileFormat, ref f, ref missing, ref f, ref missing, ref f, ref f, ref t, ref t, ref f, ref Encoding, ref f, ref f, ref LineEnding, ref f);

    Label1.Text = "ok.";

    object nosave = WdSaveOptions.wdDoNotSaveChanges;
    doc.Close(ref nosave, ref missing, ref missing);
    app.Quit(ref nosave, ref missing, ref missing);

     

    Wednesday, April 23, 2008 4:29 AM

All replies

  • User312496708 posted

    I also used to face the same problem. Try the following stuff. See to it that no instance of word is opened when you try thiss code. see to it that the user running the asp.net applictaion has proper permission to open the word document5. Normally the user do not have the permission to add the permission using the DCOMCNFG

    Friday, April 25, 2008 1:15 AM
  • User-1717665820 posted

     Hi Friends,

     

    I have the same problem open word from IIS it is not throughning any error and not opening the page I have given all permission to ASPNET user on DCOMCNFG word componet.

    plz help me in this.

    Friday, July 25, 2008 2:05 AM