Export excel question RRS feed

  • Question

  • I have a website with export to excel function.

    When I run the website is VS2010, the function export work all right, but when the site is running at IIS, It doesn't work. the exception as following:

    Exception from HRESULT: 0x800A03EC

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC

    Source Error:

    Line 1408:
    Line 1409:      //create Excel File by using c# 
    Line 1410:      xBk.SaveAs(filename, missing, missing,
    Line 1411:      missing, missing, missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlShared,
    Line 1412:      missing, missing, missing, missing, missing);

    There are my code

                string folder = "C:\\temp\\";
                string filename = folder + name + ".xlsx";

                xBk = myExcel.Workbooks.Add(true);

                xSt = (Excel._Worksheet)xBk.ActiveSheet;
                xSt.Name = name;

                myExcel.ActiveWindow.DisplayGridlines = false;

                //create Excel File by using c# 
                xBk.SaveAs(filename, missing, missing,
                missing, missing, missing, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlShared,
                missing, missing, missing, missing, missing);
                myExcel.Visible = false;

                xBk.Close(false, System.Reflection.Missing.Value, System.Reflection.Missing.Value);


    Friday, March 11, 2011 7:50 AM


All replies