Question Working with Office Excel in ASP.NET

domondios

Member
Joined
Aug 25, 2008
Messages
8
Location
Johannesburg, South Africa
Programming Experience
5-10
Hi there everyone. I'm in need of assistance.

I created a website that wrote values from a datagrid directly into an Excel Spreadsheet. On the pc that had Office 2007, i added a COM Reference to Microsoft Excel 12.0 Object Librabry and the 5.0 Object Library. After finishing, I moved the app to the test server that is running Office 2003. When I ran it, it broke with and error from Web.Config. I went and added the COM Reference to Excel 11.0 Library and had to remove the reference to the 12.0 Library as the app wouldn't build. When it was working I deployed the app to IIS and logged off the server. I then used the original pc with Office 2007 to open the site to test the Excel feature. It broke again telling me that the reference I addded couldn't be found.

I assume that the DLL's for one version of Office are different for other versions of Office.

I need to get this to work regardless on what version of Office is installed. Ideally i only need access to Excel and to a Workbook with 1 Worksheet. Is there something I can include in order to make this possible?

Any help will be greatly appreciated.

Thanks,
domondios
 
With early binding which is normal use of Office automation libraries you are bound to a specific version. Late binding is possible, but a real drag to develop with and you also have to be careful to not use any feature not supported by all versions your targeting. Start with for example How To Use Visual Basic .NET for Binding for Office Automation Servers
 
So Far So Good!

Great Title from Megadeth, otherwise, what it mean is that so far the document you sent me to is working ok. WOW!! I've leant something new. I've always restricted myself to only using code that include the intellisense, but clearly when used properly, no intellisense doen't mean the code wont work.

Thanks so much!!
 
Back
Top