473,397 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Using Excel functions in C#???

Is it possible to use an Excel function inside C# code?

Regards.

Junior.

Jun 30 '06 #1
5 18543

You can either import the Excel Library ... (like you would a COM object)
Or you can work with xml.. in an "excel flavor". (not trivial).
You can see a little bit of both at my article:

http://www.sqlservercentral.com/columnists/sholliday/

(Leveraging XP Excel , XML, and OPENXML for Data Imports)

"osmarjunior" <os*********@gmail.com> wrote in message
news:11*********************@d56g2000cwd.googlegro ups.com...
Is it possible to use an Excel function inside C# code?

Regards.

Junior.

Jun 30 '06 #2

Thanks. And both of these solutions I can use without have the MS Excel
installed on the user machines???

Regards.

Junior.

sloan wrote:
You can either import the Excel Library ... (like you would a COM object)
Or you can work with xml.. in an "excel flavor". (not trivial).
You can see a little bit of both at my article:

http://www.sqlservercentral.com/columnists/sholliday/

(Leveraging XP Excel , XML, and OPENXML for Data Imports)

"osmarjunior" <os*********@gmail.comwrote in message
news:11*********************@d56g2000cwd.googlegro ups.com...
Is it possible to use an Excel function inside C# code?

Regards.

Junior.
Jul 3 '06 #3
If you use Excel.Application then you'd have to install Office Excel.

Each time you create Excel Application object you actually open EXCEL - you can check the task manager yourself.


Microsoft released a package called "Microsoft office web components" which does not require you to install Excel.

Check it out.

Microsoft Office Web Components


Eran Aharonovich
www.Noviway.com
Jul 3 '06 #4
You can try this:

Install the last microsoft office web components.

Add reference to "Microsoft Office Web Componenets".

And use this code:


Microsoft.Office.Interop.Owc11.SpreadsheetClass ws = new Microsoft.Office.Interop.Owc11.SpreadsheetClass();

ws.get_Range("B1","B1").Value2 = 1;
ws.get_Range("B2", "B2").Value2 = 2;
ws.get_Range("B3", "B2").Value2 = 3;

ws.get_Range("A1", "A1").Formula = "=SUM(B1:B3)";
double value = (double)ws.get_Range("A1", "A1").Value2;


Eran Aharonovich
www.Noviway.com
Jul 3 '06 #5
No, you can't use Excel functions without having excel installed, nor is xml
of any help here.

Willy.

"osmarjunior" <os*********@gmail.comwrote in message
news:11**********************@m79g2000cwm.googlegr oups.com...
|
| Thanks. And both of these solutions I can use without have the MS Excel
| installed on the user machines???
|
| Regards.
|
| Junior.
|
| sloan wrote:
| You can either import the Excel Library ... (like you would a COM
object)
| Or you can work with xml.. in an "excel flavor". (not trivial).
| >
| >
| You can see a little bit of both at my article:
| >
| http://www.sqlservercentral.com/columnists/sholliday/
| >
| (Leveraging XP Excel , XML, and OPENXML for Data Imports)
| >
| >
| >
| "osmarjunior" <os*********@gmail.comwrote in message
| news:11*********************@d56g2000cwd.googlegro ups.com...
| Is it possible to use an Excel function inside C# code?
|
| Regards.
|
| Junior.
|
|
Jul 4 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: info | last post by:
After using clipboard functions in Excel controlled from Access VBA, Excel doesn't quit when I use the following ExcelApp.Quit Set ExcelApp = Nothing If I don't use the clipboard functions in...
1
by: | last post by:
Hi all, I have some statictcle functions in C#, I am making some Excel templates, they are xls files. How to make my template using these functions? Before these functions are in Excel VB so...
7
by: Gal Zilberman | last post by:
Hi I've found a code which should work, but it doesn't. Please Help Imports Microsoft.Office.Interop ' Refence in the Class Dim oExcel As New Object Dim oBook As Object Dim oSheet As Object...
1
by: Dartish | last post by:
Hi all, Thanks in advance for the help I have a DLL that which has several functions that I can call in Excel. I am thinking of how to call these functions in a .net project (authored in C#)....
1
by: VoTiger | last post by:
Hi, i want to make my own DLL in DotNet for an Excel use. I have tried COM but i am facing a little problem... it might be normal but i hope not. Here is my problem : I have made a lot of classes...
5
by: billelev | last post by:
Hi there. I need to perform a number of financial calculations within a database I am creating. Rather than writing my own functions, I figured it would be worthwhile to use the functions that...
0
by: schizoid_man | last post by:
Hi, I've written the class below and compiled it with the 'Register for COM Interop' option set to true and I can see the resulting .dll file. However, I can not successfully pull it into the...
0
by: NiteshR | last post by:
Hi, I am developing an application that is required to update excel spreadsheets which currently take over to update. I need to create an application using C# and it needs to call the function...
12
by: mantrid | last post by:
Hello Can anyone point me in the right direction for the way to read a text file a line at a time and separate the fields on that line and use them as data in an INSERT to add a record to a mysql...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.