vendredi 7 juillet 2017

how to remove the particular object from the excel sheet while excel export in kendo?

I have to remove the first and last coloumn from the excel export and i have to set the width for each coloumn. i have managed to set the width by autowidth property but unable to remove the coloumn . here is my code-->>

 excelExport:function(e) {
                                e.preventDefault();
                                var str = e.sender.columns;
                                var sheet = e.workbook.sheets[0];
                                var titleindex = str.map(function(d) { return d['title']; }).indexOf('Action');
                                var documentKeyindex = str.map(function(d) { return d['field']; }).indexOf('documentKey');
                                console.log(">>"+titleindex);
                                console.log("docId>>"+documentKeyindex);
                               // e.sheet.columns.removeObject(titleindex);
                               // var excelSheetColumns=sheet.columns.slice(0);
                               var excelSheetColumns=sheet.columns.filter(function(excel){
                                    console.log(">>>>>>"+excel);  
                                    excel.splice(documentKeyindex,1);
                                    excel.autoWidth=true;
                                    return excel;
                                });
                                var workbook = new kendo.ooxml.Workbook({
                                    sheets:e.workbook.sheets
                                });
                                 kendo.saveAs({
                                       dataURI: workbook.toDataURL(),
                                       fileName: widgetName+".xlsx"
                                 });
                           },

how to remove the few selected coloumn from the sheet??




Aucun commentaire:

Enregistrer un commentaire