5

I've created a method to generate a excel file in C#, and it works great. But after all the development, we begin to question ourselves on the possibility to create these files on machines that do not have Office installed. I've made a few searches, and nothing has been found.

So, does anybody know of a way to generate excel files without Excel installed on a machine, but using the Interop DLL and OFFICE.dll?

If there isn't a way do it, is there any library that can make this work?

pnuts
  • 58,317
  • 11
  • 87
  • 139
Gustavo Gonçalves
  • 528
  • 1
  • 12
  • 33
  • 1
    If there is no office installed, there is no DLL you could use. So how do you think this could possibly work? You certainly are not allowed to ship that DLL with your product. You will have to use another library to create the Excel file but that most likely means that you will have to rewrite larger parts of your code – Daniel Hilgarth Oct 16 '13 at 13:33
  • 1
    Similar question about not having Office installed. http://stackoverflow.com/questions/1369361/how-can-i-programatically-create-read-write-an-excel-without-having-office-ins – Crispy Oct 16 '13 at 13:37

4 Answers4

6

This library works without office installed: http://epplus.codeplex.com/ I have used it a few times and it worked nicely for me.

Samuel
  • 710
  • 5
  • 8
1

Personnaly i use this lib : https://code.google.com/p/excellibrary/ working great !

Pascalz
  • 2,348
  • 1
  • 24
  • 25
0

I have used NPOI. Its free and very good. For most people the drawbacks below are not big issues and I am sure they will be developed later so I only put them here to aid consideration.

The minor problems that I have so far are:

  • You cant easily "transpose" your data.
  • You cant easily insert columns.

No problem inserting rows, but you have to write your own custom functionality to insert columns or to transpose. I'm sure there are other limitations but I have not come across them yet. Overall, if these are the only 2 problems I have, I'll not complain (especially considering I have sufficiently resolved them for my own purposes).

If I had to export again at some point, I'd probably give the Office OpenXML library a try. But I'm not sure if this requires you to store a file on the server or not before transferring (or have office installed on the server). If either of these were true, I'd have to say no personally. This is the reason I did not use Excel Package (Linked in other answers). Not sure if it's changed but when I researched it, you had to store the file on the server before transferring it.

Francis Rodgers
  • 4,565
  • 8
  • 46
  • 65
-3

You do not have to install Excel all what you need Microsoft Office 2010 Primary Interop Assemblies.
You can download them from:

http://msdn.microsoft.com/de-de/library/aa288681(v=vs.71).aspx

OR

http://msdn.microsoft.com/de-de/library/ms247298(v=office.11).aspx

Bassam Alugili
  • 16,345
  • 7
  • 52
  • 70