1

I've come across ExcelPackage and I found a couple of examples of using it, but none seem to work, they've all got some aspect, component missing or are for a different version of Visual Studio. I simply need to generate a .xls or .xlsx or even a .csv file, but as I am using a 3rd party server I can't use the Office .com objects. I have used SpreadsheetGear in the past which is expensive and as I am retired, I can't afford this sort of product.

If anyone has a working example of ExcelPackage or any other freeware offering, or can point me in the direction of one that has everything I need, it would be appreciated. A regular Web App rather than MVC would be preferred.

2
  • You didn't want to use the COM objects. They either don't work at all, or are flaky, and unsupported in a server, and may violate your Office license. Commented Mar 22, 2013 at 23:48
  • 1
    CSV is just plain text - you can do that without any components... Commented Mar 23, 2013 at 0:36

2 Answers 2

2

Take a look at Simplexcel by Michael Stum. It is designed around simplicity, is fully supported under ASP.net and should allow you to make simple, but extremely usable Excel cheats. You have an simple example available here.

Sign up to request clarification or add additional context in comments.

9 Comments

This looks like it will do the job, but I am am new to this sort of thing and it is trying to save to the server. How do I get the file that is generated on the server to save to my local PC? I have looked around the net and I can only find examples of saving existing files, not on the fly generated files.
Tthat is a bit outside of the scope of your original question. I would recommend opening a new question for taht, but you could probably do something like this. MemoryStream stream = new MemoryStream(); wb.Save(stream, CompressionLevel.Maximum); return new FileStreamResult(stream, "application/vnd.ms-excel"); Basically storing the result in Memory, and then using FileStreamResult to return it in ASP.net.
Ok, thanks eanderason. I will do just that. I am not using MVC and FileStreamResult is an MVC component, so need something for webforms. I suspect it is going to use HTTP handlers.
You can do the same for WinForms. Would sending them as an email be an option?
I can't use winforms, but an email would be a non-preferred option. I can't store the file though on the server.
|
0

Check out the Open XML SDK. This gives you the ability to generate and manipulate Office documents without using Office itself or the interop, and as such makes it a suitable approach from the server-side.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.