How to custom funcation in Excel2003 with C#
-
:(Recently I want to design a report forms that base on excel2003.But the primary function in Excel 2003 can not satisfies the business needs.So I have many funcations to get data from SQL Server in c# .I want to transform these function into Excel 2003 custom function. Can you tell me how to do it? Thanks!
-
:(Recently I want to design a report forms that base on excel2003.But the primary function in Excel 2003 can not satisfies the business needs.So I have many funcations to get data from SQL Server in c# .I want to transform these function into Excel 2003 custom function. Can you tell me how to do it? Thanks!
You would have to go one of three routes. 1) Write Excel macros in VBA, using ADO to get the data out of the database and then populate the spreadsheet with the values you get back. 2) Use Visual Studio Tools for Office to write your "macro" code in C# and use ADO.NET to get your data out of the DB. This assumes that you can afford VSTO or that you have an MSDN subscription. 3) Use the Office Primary Interop Assemblies to make calls out to Excel. This is a lot more cumbersome than using VSTO, but it's free (assuming you have Office installed).
Picture a huge catholic cathedral. In it there's many people, including a gregorian monk choir. You know, those who sing beautifully. Then they start singing, in latin, as they always do: "Ad hominem..." -Jörgen Sigvardsson