The Artima Developer Community
Sponsored Link

C# Answers Forum
Opening Excel 2003 file by c#

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Hani Ramdan

Posts: 2
Nickname: alsheehab
Registered: Dec, 2008

Opening Excel 2003 file by c# Posted: Jan 2, 2009 1:23 PM
Reply to this message Reply
Advertisement
Hi everyone

First ,My name is Hashem I'm a beginner in c#, 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? where I use the following code that i have collected from many reference.



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");

Topic: SQL Database Unit Testing in C# Previous Topic   Next Topic Topic: C# and Delphi

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use