How do I open an Excel97 document through c#??? Need Help!
Johan,
Are you trying to use the objects for Excel 97 or are you trying to open
an Excel 97 document in Excel 2002? If you are trying to use the objects,
then you have to make sure that you set a reference to the correct dll's in
your application.
If you are just trying to open the document, then it should be able to
handle the document on its own. If that isn't working then you might want
to look at the FileConverters property on the Application object, to see if
there is something installed for the Excel 97 document type and use that
when you open the document using the Workbooks object.
Hope this helps.
--
- Nicholas Paldino [.NET MVP]
Quote:
> Hi!
> I've quite a newbie and I wonder how I should Open an Excel7.0 Workbook
> (excel8 lib) using C#.
> I've made an application that works for excel2000 and excel XP, but it
does
> not work with excel97.
> these are the lines that does the trick for me in 2000+
> private Excel.Application excelObj = null;
> Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
> excelObj = new Excel.Application();
> Workbook wb = excelObj.Workbooks.Open(Directory.GetCurrentDirectory() +
"/report.xls",0,true,5,"","",false,Excel.XlPlatform.xlWindows,"",false,fals
e
Quote:
> ,0,false,true,false);
> Worksheet sheet = (Worksheet) wb.Worksheets.get_Item("Sheet1");
> sheet.Activate();