Kendo Grid export to excel remove desired column and remove footer row

1 posts, 0 answers
  1. ASPN
    ASPN avatar
    6 posts
    Member since:
    Jan 2019

    Posted 26 Feb Link to this post

    I am using UI for ASP.NET MVC Grid.

    I need to export editable grid data into excel and then import on same grid for some data manipulation

    But I have restriction not to export the footer row and having 15 visible column out of which 6 column need not to exported.

    After doing a lot of research I found this way I can only export without footer  but could not able achieve removing  desired column in gird data export.

    function ExportToExcel(e) {

             var rows = e.workbook.sheets[0].rows;
           
            var newRows = []
            for (var ri = 0; ri < rows.length; ri++) {
                var row = rows[ri];
                            
                //row.hideColumn.hideColumn("Col1");
                //row.hideColumn.hideColumn("Col2");
                //row.hideColumn.hideColumn("Col3");
                //row.hideColumn.hideColumn("Col4");
                //row.hideColumn.hideColumn("Col5");
                //row.hideColumn.hideColumn("Comments");
                if (row.type !== "group-footer" && row.type !== "footer") {
                   
                    newRows.push(row)
                }
            }
            e.workbook.sheets[0].rows = newRows
           
        }

    Kindly post your solution with sample code  to remove desired columns from gird while export along with removing footer row.

    Please let me know if any more detail needed. in the code above commented code is just example one of the example how many way I tried but not succeeded.

     

    Thank you


Back to Top