Peter
Peter

Reputation: 9712

Alternative to Excel as ASP.Net Report Generator

I use excel through vb.net/asp.net to generate reports from a web page and then send the file down to the user. We've had some issues with Excel being super slow/inefficient/not closing (even when we keep track of the process id and try to kill it in code...). So I'm looking for some flexible alternatives. We need a replacement that can:

These are all the features I can think of off hand, any help or suggestiong at alternative libraries to look at would be appreciated. We are running Excel 2007 on the server but we are rolling out Office 2010 to clients so I think that might open the doors for some more supported file formats, if that helps.

Upvotes: 3

Views: 2460

Answers (5)

ArBR
ArBR

Reputation: 4082

I recommend you to use the DevExpress.XtraReports from DevExpress. It is a Licensed product, but offers you a friendly toolkit for generating great and complexity reports. It is well documented and easy to use, once you define a template (REPX) you can populate it with data by assigning to each element a value as well as using [mail merge] feature which will be automatically replaced once you bind with data the report. In the core of such technology is a well OO design of classes. Once you generate the report you can export it to the most common formats: XLS, HTML, PDF, RTF...

public void GenerateReportFile(string rptFileName, string param1, int param2)
{
    XtraReport report = null;
    try
    {
        report = new XtraReport();
        //-- loads the layout template (repx file)
        report.LoadLayout("SomeDirectory\report_template.repx");
        //-- assign data to report controls
        report.FindControl("Label1", true).Text = string.Format("{0:dd/MM/yyyy}", fecha1);
        report.FindControl("Label2", true).Text = string.Format("{0:dd/MM/yyyy}", fecha1);
        //-- gets data from some Data Acces Layer method and assig it to the report DataSource property
        DALReport dal = new DALReport();
        report.DataSource = dal.GetReport1Data(ExpEmp, param1, param2);
        report.DataMember = "data";
        report.ExportToPdf(rptFileName, options);
    }
    catch { throw; }
    finally { if (report != null) { report.Dispose(); } report = null; }
}

For more information refers to: http://demos.devexpress.com/XtraReportsDemos/

There is another free library for .Net iTextSharp, this library was originally written for Java, then was translated to C# for .Net usage. The library is mainly for PDF documents creation but some versions also supports XLS documents creation.

Upvotes: 1

Peter
Peter

Reputation: 9712

After looking through the various options and performing more independent research I ended up using EPPlus, which you can get @ http://epplus.codeplex.com.

Thanks for all the suggestions.

Upvotes: 1

StingyJack
StingyJack

Reputation: 19479

Office Web Components (though dated) is free and has worked for me in the past.

If you want to spend the loot, Aspose Cells is a good way to go also.

Upvotes: 0

Gabriel McAdams
Gabriel McAdams

Reputation: 58293

It sounds like you are using a library that opens Excel and uses MS Office Excel objects to create the Excel file. Since you are using 2007 and above, you may want to consider creating the Excel file manually using a library that creates the XML (therefore, Excel doesn't open at all).

Check out ExcelLibrary.

While doing a search on this, I found this page (on StackOverflow) that provides some sample code.

Upvotes: 0

rerun
rerun

Reputation: 25505

GNU plot is a little bit of a pain to get to run on windows but it is a an awesome tool

Upvotes: 0

Related Questions