Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5368
Terrific WebExcelExporter Ajax article by Duane Hoyte
posted

A while back, Duane wrote an article in this forum detailing how to do an ajax postback that resulted in the Excel document downloading.  It was quite good and pretty deep, but I never got a chance to implement it.

Now I am back to try it, and I can't find the article.  It looks like somebody cleaned out the forums, deleting some good content in the process.

Can somebody please retrieve it?

And can somebody please give your developers someplace they can post this kind of stuff without worrying about a moderator deleting it?

Parents Reply
  • 5368
    Offline posted in reply to [Infragistics] Duane Hoyt

    Hey Duane,

    I don't agree that exporting large datasets is outside the ability of a web server.

    I put together a simple little app that generates large recordsets, and then tests the time it takes to export that recordset using various methods.  Have a look at this:

    For a recordset of 50,000 rows, the WebExcelExporter took over 4 minutes!  That is really too long, regardless of what environment you are in.  All of the other methods returned a memory stream in a matter of seconds.

    The result that was really stunning though was the BIFF format.  This is probably the fastest possible method to export data to Excel, being that it is direct-to-binary.  It shows just how "within the scope of a web server" the export of these files can be.  I was startled to click the button and see the worksheet pop up almost instantly.  Unfortunately, the BIFF format is limited to 65k records per spreadsheet. 

    It would be interesting to do a solution where you could output large recordsets to BIFF, and have it wrap onto new spreadsheets when it reaches the row limit of one spreadsheet.  There's your proof of concept that it is possible to export very large numbers of records at crazy-fast speeds.  By my calculation, BIFF could export 1 million rows in 15 seconds, with a super-small memory footprint to boot.

    Regarding Infragistics Excel, I was also pleased to see that with larger resultsets, parallel processing dramatically reduces the time it takes to populate the Worksheet object.  This is on my single-CPU workstation.  Time was cut from 59 seconds to 35 seconds.

    However, SpreadsheetGear has you beat soundly (and also proves the concept).  Note that the SpreadsheetGear solution was able to generate a worksheet with 1 million rows and also stream it in under 1 minute.  That is acceptable for an async operation in my environment.

    Some good news for you guys... With parallel loading, I was able to populate your Worksheet object in a time very close to theirs.  However, I was unable to execute Workbook.Save() because of other issues... which brings me to the next topic.

    There seems something very wrong with Workbook.Save().  It is extraordinarily expensive, both in terms of memory, and processing time.  I can populate 600,000 rows into an IG Worksheet object in 11 seconds, but it takes 74 seconds (and a lot of memory) for Workbook.Save to write to the memorystream.  I can't process row counts larger than that without Workbook.Save crashing.

    Workbook.Save() is the bottleneck.  With that improved, you have a path to a high performance Excel exporter that would compete with SpreadsheetGear.

    I tried attaching my project as a .zip file to this post.  If it didn't take, let me know, and I will be glad to send it by other means.

Children