This is a migrated thread and some comments may be shown as answers.

Excel export not working with more than a thousand records

3 Answers 1225 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matias
Top achievements
Rank 1
Matias asked on 13 Apr 2016, 07:25 PM

I've a grid with ajax binding and exports to excel/PDF fine when dealing with less than a thousand records. But when I want to export bigger quantities the grid doesn't do anything at all. I even put breakpoints in both export actions with no luck.

What can I do to solve this issue?

This is my grid:

<script src="~/Scripts/lib/jszip.min.js" type="text/javascript"></script>
<script src="~/Scripts/lib/pako.js" type="text/javascript"></script>
<script src="~/Scripts/KendoUI/ExportPDFCustomizing.js" type="text/javascript"></script>

@(Html.Kendo().Grid(Model)
        .Name("OperacionesDelDia")
        .DataSource(dataSource => dataSource
        .Ajax()
            .Read(read => read.Action("OperacionesDelDia_Read", "Operaciones")
            .Data("PasarParametros"))
        .Aggregates(a =>
            {
                a.Add(p => p.oper_monto).Sum();
                a.Add(p => p.oper_mont_neg).Sum();
            })
        .PageSize(30)
        )
        .Columns(columns =>
        {
            columns.Bound(foo => foo.esto_codigo).Title(Global.Estado);
            columns.Bound(foo => foo.oper_numero)
                .Title(Global.Numero)
                .ClientTemplate("<a onclick=\"showDetails('#= oper_numero #')\" href='\\#'>#= oper_numero #</a>");            
            columns.Bound(foo => foo.merc_codigo).Title(Global.Mercado);
            columns.Bound(foo => foo.oper_nrobol).Title(Global.Boleto);
            columns.Bound(foo => foo.clas_codigo).Title(Global.Clase);
            columns.Bound(foo => foo.tope_codigo).Title(Global.TipoOperacion);
            columns.Bound(foo => foo.ClieNombre).Title(Global.RazonSocial);
            columns.Bound(foo => foo.espe_codigo).Title(Global.Especie);
            columns.Bound(foo => foo.cupo_numero).Title(Global.Cupon).Hidden(true);
            columns.Bound(foo => foo.clie_alias).Title(Global.ClienteAlias).Hidden(true);
            columns.Bound(foo => foo.oper_forigen).Title(Global.FechaOrigen).Format("{0:dd/MM/yyyy}");
            columns.Bound(foo => foo.oper_plazo).Title(Global.Plazo).Hidden(true);
            columns.Bound(foo => foo.oper_fvence).Title(Global.FechaVence).Format("{0:dd/MM/yyyy}");
            columns.Bound(foo => foo.oper_monto).Title(Global.Capital).Format("{0:N}").ClientFooterTemplate("#= kendo.format('{0:N}', sum)#");
            columns.Bound(foo => foo.espe_codcot).Title(Global.EspecieNeg).Hidden(true);
            columns.Bound(foo => foo.oper_tna).Title(Global.Tna);
            columns.Bound(foo => foo.oper_interes).Title(Global.Interes).Hidden(true);
            columns.Bound(foo => foo.oper_mont_neg).Title(Global.Monto).Format("{0:N}").ClientFooterTemplate("#= kendo.format('{0:N}', sum)#");
            columns.Bound(foo => foo.clie_cuit).Title(Global.Cuit).Hidden(true);
            columns.Bound(foo => foo.TipoNroDoc).Title(Global.TipoNroDoc).Hidden(true);
            columns.Bound(foo => foo.usua_codigo).Title(Global.Usuario);
            columns.Bound(foo => foo.usua_alta).Title(Global.UsuarioAlta).Hidden(true);
            columns.Bound(foo => foo.oper_falta).Title(Global.FechaAlta).Format("{0:dd/MM/yyyy}").Hidden(true);
            columns.Bound(foo => foo.liquidada).Title(Global.Liquidado).Hidden(true);
            columns.Bound(foo => foo.usua_surperv).Title(Global.UsuarioSuperv).Hidden(true); 
            columns.Bound(foo => foo.oper_nombre).Title(Global.Operador).Hidden(true); 
            columns.Bound(foo => foo.oper_observ).Title(Global.Observaciones).Hidden(true); 
            columns.Bound(foo => foo.espedesc).Title(Global.EspecieDesc).Hidden(true); 
            columns.Bound(foo => foo.orden_numero).Title(Global.Orden).Hidden(true);
        })
        .Excel(excel => excel
            .FileName("Reporte.xlsx")
            .Filterable(true)
            .AllPages(true)
            .ProxyURL(Url.Action("Excel_Export_Save", "Operaciones"))
        )
            
        .Pdf(pdf => pdf
            .PaperSize("A4")
            .AllPages()
            .Landscape()
            .FileName("Reporte.pdf")
            .ProxyURL(Url.Action("Pdf_Export_Save", "Operaciones"))
        )

        .Events(e => e.PdfExport("ExportarPDF"))
        .ToolBar(t => t.Excel().Text("Exportar a Excel"))
        .ToolBar(t => t.Pdf().Text("Exportar a PDF"))
        .ColumnMenu()
        .Pageable()
        .Sortable()
        .Selectable()
        .Scrollable(s => s.Height(320))
        .Groupable()
        .Resizable(resize => resize.Columns(true))
        .Reorderable(reorder => reorder.Columns(true))
        .Filterable(ftb => ftb.Mode(GridFilterMode.Menu))
    )

<script type="text/javascript">

function PasarParametros() {

        var dpFechaDesde = $("#fechaDesde").data("kendoDatePicker");
        var valorFechaDesde = dpFechaDesde.element[0].value;

        var dpFechaHasta = $("#fechaHasta").data("kendoDatePicker");
        var valorFechaHasta = dpFechaHasta.element[0].value;

        var ddlLiquidadas = $("#liquidadas").data("kendoDropDownList");
        var valorLiquidadas = ddlLiquidadas.element[0].value

        return {
            fechaDesde: valorFechaDesde,
            fechaHasta: valorFechaHasta,
            liquidadas: valorLiquidadas
        };
    }
</script>

 

And these are my actions:

 

[HttpPost]
public ActionResult Excel_Export_Save(string contentType, string base64, string fileName)

        {
            var fileContents = Convert.FromBase64String(base64);

            return File(fileContents, contentType, fileName);
        }

        [HttpPost]
        public ActionResult Pdf_Export_Save(string contentType, string base64, string fileName)
        {
            var fileContents = Convert.FromBase64String(base64);

            return File(fileContents, contentType, fileName);
        }

 

Thank you very much

3 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 14 Apr 2016, 07:45 AM

Hello Matias,

There are certain limitations in the quantity if items that could be exported using the built in Excel/PDF export. The reason for this is that the file is constructed completely on the client side. The Controller actions will only be hit if the browser cannot serve the file to the user. The exact limit will differ per Grid configuration, browser version, OS etc, but in cases like the current we do not recommend using the built in client side export and use some 3rd party library for server side export instead.

Regards,
Dimiter Madjarov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Jean
Top achievements
Rank 1
answered on 20 Dec 2018, 01:04 PM

Hi Dimiter,

Can you direct us to which 3rd party to use & which technique to use to increase the capacity. Now we are able to export approx 5k rows and we would need 10k rows.

 

0
Preslav
Telerik team
answered on 24 Dec 2018, 08:15 AM
Hi Jean,

At this stage, you could do Server-Side export with our Telerik Document Processing library:
I would suggest checking the below links:


Regards,
Preslav
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Matias
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Jean
Top achievements
Rank 1
Preslav
Telerik team
Share this question
or