Export more than 100000 rows to Excel - Infragistics Excel exporter

Estefany Velez picture Estefany Velez · Jun 4, 2012 · Viewed 9.2k times · Source

I am using ultrawebgrid v11.1 with xml LoadOnDemand and paging enabled to load more than 100,000 records.

I'd written BindGrid() functionality inside the InitializeDataSource event.

In every postback(Save,ExcelExport,Load..) and/or partial postback(Page navigation,Sorting,filtering..), I am fetching more than 100,000 records from the database and setting the Grid's DataSource.

Issue 1:

Each time querying large amount of data from database is taking more time. Is there a way to query for the data only once on load and subsequently when the data in the grid is modified.

Issue 2:

I am using UltrawebgridExcelExporter v11.1. On click of Export button, Grid's data source is initialized inside InitializeDataSource with more than 100,000 records fetched from database.

I have got to know that when xml LoadOnDemand is set, each time when I export to excel, I should set

AllowPaging = False  

and

LoadOndemand = LoadOnDemand.NotSet

then bind the grid and Export.

Fetching huge data from database is taking long time and binding it is taking even longer. After binding, while exporting to excel it is throwing 'System Out of Memory' exception.

Issue 3:

I am not sure even after solving the issues above, will I be able to export more than 65535 rows in Excel 97-2003?

How to optimize the performance of all the operations of the grid with the xml LoadOnDemand.

Code:

Protected Sub UWGrid_InitializeDataSource(ByVal sender As Object, ByVal e As Infragistics.WebUI.UltraWebGrid.UltraGridEventArgs) Handles UWGrid.InitializeDataSource

UWGrid.DataSource = dsData 'record set with 100000 rows.

End Sub

Protected Sub btnExportToExcel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExportToExcel.Click

UWGrid.DisplayLayout.Pager.AllowPaging = False

UWGrid.DisplayLayout.LoadOnDemand = LoadOnDemand.NotSet

UWGrid.DataBind()

'Dim wBook As New Excel.Workbook(Excel.WorkbookFormat.Excel2007)

UltraWebGridExcelExporter1.DownloadName = "ExportFile.xls"

UltraWebGridExcelExporter1.Export(UWGrid)

End Sub

Answer

Yuriy Galanter picture Yuriy Galanter · Jun 12, 2012

To answer your Issue 3 - 65535 rows is not Infragistics limitation, it's a limitation of Excel 97/2003 format. The only way around it is to export in Excel 2007+ format (XLSX)