Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

Show column and customize excel before export

$
0
0

I want to show/hide some columns on Kendo Grid and customize export to the excel.

Export conditions:

  • use grid filter selection
  • use grid seletected items
  • show/hide columns programaticaly

Is it possible to combine?

Is posible to export programaticaly only 5000 rows?

For export I use:

varexportFlag = false;
$("#grid").data("kendoGrid").bind("excelExport", function(e) {
if(!exportFlag) {
        e.sender.showColumn(0);
        e.preventDefault();
        exportFlag = true;
        setTimeout(function() {
            e.sender.saveAsExcel();
       });
    } else{
        e.sender.hideColumn(0);
       exportFlag = false;
    }
});

Customize excel code:

varsheet = e.workbook.sheets[0];
   for(varrowIndex = 0; rowIndex < sheet.rows.length; rowIndex++) {
       varrow = sheet.rows[rowIndex];
       if(rowIndex == 0) {
           for(varcellIndex = 0; cellIndex < row.cells.length; cellIndex++) {
               row.cells[cellIndex].background = "#0070C0";
               row.cells[cellIndex].color = "#FFFFFF";
               row.cells[cellIndex].bold = true;
           }
       }
 
       if(rowIndex > 0 && rowIndex % 2 == 0) {
           for(varcellIndex = 0; cellIndex < row.cells.length; cellIndex++) {
               row.cells[cellIndex].background = "#DCE6F1";
           }
       }
   }

Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>