Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
.NET Win Forms Application to Excel 2002, Excel 2003, and Excel 20
Is it possible to access all 3 object models from C# or VB.NET?
My dot net Windows Forms application needs to be able to open an Excel file, modify it and then save it. The application is .NET and will probably be implemented in either C# or VB.NET and needs to supports users who might have one of 3 different version of Excel on their machine: - Excel 2002 - Excel 2003 - Excel 2007 Any guidance on how this can be accomplished? Thanks in advance, George (BTW: This is a repost: my original apparently didn't not have my posting-alias set up in my profile) |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
.NET Win Forms Application to Excel 2002, Excel 2003, and Excel 20
Hello George,
Welcome to Microsoft Managed Newsgroup Support Service! My name is Jialiang Ge, from Microsoft Managed Newsgroup support team. From your post, my understanding on this issue is: you wonder how to write automation clients in C# or VB.NET for multiple Office versions (e.g. Excel 2002, 2003, 2007), so that our client application (the winform) can supports users who might have one of the 3 different version of Office. If I'm off base, please feel free to let me know. According to the KB article http://support.microsoft.com/kb/244167/EN-US/, there are two approaches that we can accomplish the task: 1. If we are using "early binding", namely, directly referencing an Office interop assembly in the application, we can reference the interop assembly of the earliest version of the Office application we intend to automate. This is called "backward compatibility". In this case, we can reference "Microsoft Excel 10.0 Object Library" which is for Excel 2002. One drawback of this approach is that it does not allow our automation client to use functionality in a new version of Office (e.g. the new function "Export to PDF" which is only available to Office 2007). If we do need to use functionality in a newer version of Office, but we are developing a project that must work on systems that contain more than one version, we should use late binding to make the call (see approach 2). 2. We can use late binding. If we intend to use Late binding, I'd personally suggest writing code with VB.NET. VB.NET provides a much easier interface for late binding than C#. For more details about the two approaches, please read the KB article http://support.microsoft.com/kb/244167/EN-US/. About early binding and late binding, we can refer to http://support.microsoft.com/kb/245115/ Please let me know if you have any other concerns, or need anything else. I will be more than happy to be of assistance. Regards, Jialiang Ge , remove 'online.') Microsoft Online Community Support ================================================== For MSDN subscribers whose posts are left unanswered, please check this document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscripti...ult.aspx#notif ications. If you are using Outlook Express/Windows Mail, please make sure you clear the check box "Tools/Options/Read: Get 300 headers at a time" to see your reply promptly. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscripti...t/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
.NET Win Forms Application to Excel 2002, Excel 2003, and Exce
That's it exactly!
Thanks, Jialiang "Jialiang Ge [MSFT]" wrote: Hello George, Welcome to Microsoft Managed Newsgroup Support Service! My name is Jialiang Ge, from Microsoft Managed Newsgroup support team. From your post, my understanding on this issue is: you wonder how to write automation clients in C# or VB.NET for multiple Office versions (e.g. Excel 2002, 2003, 2007), so that our client application (the winform) can supports users who might have one of the 3 different version of Office. If I'm off base, please feel free to let me know. According to the KB article http://support.microsoft.com/kb/244167/EN-US/, there are two approaches that we can accomplish the task: 1. If we are using "early binding", namely, directly referencing an Office interop assembly in the application, we can reference the interop assembly of the earliest version of the Office application we intend to automate. This is called "backward compatibility". In this case, we can reference "Microsoft Excel 10.0 Object Library" which is for Excel 2002. One drawback of this approach is that it does not allow our automation client to use functionality in a new version of Office (e.g. the new function "Export to PDF" which is only available to Office 2007). If we do need to use functionality in a newer version of Office, but we are developing a project that must work on systems that contain more than one version, we should use late binding to make the call (see approach 2). 2. We can use late binding. If we intend to use Late binding, I'd personally suggest writing code with VB.NET. VB.NET provides a much easier interface for late binding than C#. For more details about the two approaches, please read the KB article http://support.microsoft.com/kb/244167/EN-US/. About early binding and late binding, we can refer to http://support.microsoft.com/kb/245115/ Please let me know if you have any other concerns, or need anything else. I will be more than happy to be of assistance. Regards, Jialiang Ge , remove 'online.') Microsoft Online Community Support ================================================== For MSDN subscribers whose posts are left unanswered, please check this document: http://blogs.msdn.com/msdnts/pages/postingAlias.aspx Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscripti...ult.aspx#notif ications. If you are using Outlook Express/Windows Mail, please make sure you clear the check box "Tools/Options/Read: Get 300 headers at a time" to see your reply promptly. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscripti...t/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
.NET Win Forms Application to Excel 2002, Excel 2003, and Exce
You are welcome. It's my pleasure to be of assistance. : )
Jialiang Ge , remove 'online.') Microsoft Online Community Support ================================================== Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: . This posting is provided "AS IS" with no warranties, and confers no rights. ================================================== |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
.NET Win Forms Application to Excel 2002, Excel 2003, and Excel 20 | Excel Programming | |||
Parameters in Forms Buttons - not working in Excel 2002 | Excel Programming | |||
Excel 2000 VBA App Now Works in Excel 2003, but not Excel 2002 | Excel Programming | |||
Data Forms in Excel 2002 | Setting up and Configuration of Excel | |||
MDI Forms in Excel 2002 XP | Excel Programming |