I want to use Microsoft.Office.Interop.Excel on my server but I don't know what I should install there. I found two different answers. Frist which tells that I must install entire MS Office and the second that I must install only Excel. What’s the true?
Asked
Active
Viewed 206 times
0
-
1Off-topic, but have you tried EPPlus? It's a good framework to generate excel files. – Yahya Mar 31 '14 at 09:24
-
2You need to install Excel only (you're accessing through COM only Excel). BTW DO NOT use Office server-side...Office COM interop has not been made to be used on server-side code. It may hang and your server may even crash/run out of resources (what if, for example, Excel stops waiting for a user confirmation? how a spurious message box will be handled?). Much better to use a library to write Excel files without Excel itself (for example you may consider Open XML to write xlsx files directly from .NET with a "nice" object model and without any other dependency). – Adriano Repetti Mar 31 '14 at 09:26
-
@Yahya I dont think this is an off-topic question. It's about programming defined in the help centre and it's not a question any pedestrian walking by can answer. – Mar 31 '14 at 10:06
-
@mehow my comment was off-topic :) – Yahya Mar 31 '14 at 10:21
-
I can't use any free frameworks for excel. I want to generate image from charts. As far as I know it's only possible in one framework: spreadsheetgear. But the price is too high. Any other solution? – Adam Łepkowski Mar 31 '14 at 11:06
-
1@Adam a question about a 3rd party library is off-topic! LOL If you don't need to save generated images as PNG (for example) but they need to be available just inside Excel then let's check (see my comment) Microsoft Open XML library. It's from Microsoft, it doesn't need Excel installation, it's pure .NET and it's free. You can create by code everything Excel supports (but you'll be limited to the new xlsx file format). – Adriano Repetti Mar 31 '14 at 11:30
-
Sorry for this extra off-topic. I need to save chart as image on hardrive. I check many libraries so don't carry it on. Your first comment help me the best. Now I know that I need only install Excel on my server machine. THX – Adam Łepkowski Mar 31 '14 at 11:35
-
@Adam see [**THIS**](http://stackoverflow.com/questions/17077378/use-vba-to-screenshot-completed-userform-and-attach-to-email/17083546#17083546). Actually using C# it should be much easier to just capture a picture of a chart... you don't need to 're-recreate' the entire clipboard because C# can access it easily. – Mar 31 '14 at 12:05
-
@mehow Thanks. I know how I can take chart image from C# - the worst thing is that I must use it: Microsoft.Office.Interop.Excel. But when I noticed the page you gave I know that I must check if it's possible to execute VBA without installing excel and then logic responsible for saving chart as image could be in excel. – Adam Łepkowski Mar 31 '14 at 12:24
-
1@Adam It's possible to call a VBA macro from C# but in such cases you need to have Excel installed. – Mar 31 '14 at 12:33
-
@mehow OK thank you. Now I know that I must install excel on server. – Adam Łepkowski Mar 31 '14 at 12:34