1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Opening Excel 2003 by c#

Discussion in 'Meet and Greet' started by hesham_51, Dec 30, 2008.

Thread Status:
Not open for further replies.
  1. hesham_51

    hesham_51 New Member

    Joined:
    Nov 3, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Hello everyone

    Frankly, I'm trying to open Excel file(2003) but I get error at Open Function in the below code :


    (Old Format Or Invalid Library Of kinds (Exception from HRESULT: 0x80028018 (TYPE_E_INVDATAREAD))


    Is there anybody can help me? :nonod: where I use the following code.



    public static Excel.Application ExlApp;
    public static Excel.Workbook ExlWrkBook;
    public static Excel.Worksheet ExlWrkSheet;



    Excel.Application ExcApp = new Excel.Application();
    ExcApp.Visible = true;
    Excel.Workbook excelWorkbook = ExcApp.Workbooks.Open("D:\\Salary Calc.xls", 0, false, 5, "", "", true,Excel.XlPlatform.xlWindows, "\t", true, false, 0, false, true, true);

    Excel.Sheets ExcSheet = excelWorkbook.Worksheets;
    string currentSheet = "Sheet1";
    Excel.Worksheet excelWorksheet = (Excel.Worksheet)ExcSheet.get_Item(currentSheet);
    Excel.Range excelCell = (Excel.Range)excelWorksheet.get_Range("A1", "A1");
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,283
    Likes Received:
    364
    Trophy Points:
    83
Thread Status:
Not open for further replies.

Share This Page