开发者

Excel file generation on server without Excel installed

I am using Microsoft.Office.Interop.Excel and generating Excel files using the SaveAs method. This all works correctly on computer with Excel installed. However, my server does not have Excel installed.

How can I generate my 开发者_如何学编程files?


If you generate a file using Interop you need to install Excel on the server.

Microsoft doesn't support installing Excel (or Word) on the server. Instead you should download the Office Open XML SDK from Microsoft and use that library to generate Excel 2007 documents. This library does not require Excel to be installed on the server: http://msdn.microsoft.com/en-us/office/ee441239.aspx


If you are talking about Excel prior to MS Office 2010, there is no set of "client libraries" that can be used to create Office documents.
"Interop" assemblies are just .net wrappers around Microsoft's unmanaged code, that make the Excel API available to .net clients.
You will have to install MSOffice on the server.

EDIT: A similar question here: Excel dll for Microsoft.Office.Interop.Excel


If you can afford a third party library, Spreadsheetgear is a good investement.


I'd recommend FileHelpers library to read and write Excel (and others) files.

"The FileHelpers are a free and easy to use .NET library to import/export data from fixed length or delimited records in files, strings or streams."

It works well for me, give it a try.


If you are ok with the new Open Office Xml format (xlsx) I would highly recommend taking a look at the free .Net library EPPlus. It is easy to use and has a ton of features.


If you just need data in the files and no graphs etc, I would just go with XML or CSV format. Both are open formats and don't require interop binaries.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜