简体   繁体   English

Infragistics WebExcelExporter设置要导出的最大行数

[英]Infragistics WebExcelExporter set max number of rows to export

I use the infragistics WebDataGrid to show a number of elements in an ASP.NET application. 我使用基础设施WebDataGrid来显示ASP.NET应用程序中的许多元素。 Now I use the WebExcelExporter class to create a excel file for the all paged rows. 现在,我使用WebExcelExporter类为所有分页的行创建一个excel文件。 In the WebExcelExporter I can use the DataExportMode Property to set the number of elements, which should be exported. 在WebExcelExporter中,我可以使用DataExportMode属性设置应导出的元素数量。 The DataExportMode property can be set to DataExportMode.AllDataInDataSource and DataExportMode.DataInGridOnly. 可以将DataExportMode属性设置为DataExportMode.AllDataInDataSource和DataExportMode.DataInGridOnly。

Now the problem is that I can only show the results from the current page or all pages. 现在的问题是,我只能显示当前页面或所有页面的结果。 Due to performance I want to export only a max number of 4000 rows. 由于性能,我只想导出最多4000行。 Is it possible to set a max number of rows, which should be exported? 是否可以设置应导出的最大行数?

By design the grid provides the ability to exoport DataInGridOnly and AllDataInDataSource, yes. 通过设计,网格可以导出DataInGridOnly和AllDataInDataSource,是的。 Although if you want to limit the exported rows, you can always use GridRecordItemExporting in order to cancel the execution. 尽管如果要限制导出的行,则始终可以使用GridRecordItemExporting来取消执行。

Code snippet: 程式码片段:

protected void excelExporter_GridRecordItemExporting(object sender, GridRecordItemExportingEventArgs e)
{
    if (e.CurrentRowIndex > 4000)
    {
        e.Cancel = true;
    } 
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM