i am trying to add two functions to my project. One is to export the grid data as its views to an excel (i am using kendo-grid and the grid data has been formatted from the UI side) and the second one is to print the grid data with the grid lines. i have added both, but i am having two problems. 1. Exporting to excel with the numbers formatted. i used this example http://jsfiddle.net/agershun/00nfeq12/
alasql('SELECT x [No.],Type,Amount INTO XLSX("Type.xlsx",{headers:true}) FROM ?',[ $scope.data.Data]);
};
$scope.data.Data is a result of the api. So it contains the actual data. But in my grid, i have added custom formatting.
but the print just shows the data, no border lines and these are needed.
How do i solve this please? thanks
How to export to Excel and keep custom formatting?
You can write your own formatting function, for example round number to 2 digits:
alasql.fn.myfmt = function(n) {
return Number(n).toFixed(2);
}
alasql('SELECT name, myfmt(amt) INTO XLSX("john.xlsx",{headers:true}) \
FROM ?',[$scope.items]);
See the example at jsFiddle
How to print Kendo UI grid?
You can read and try the example how to print fron Kendo UI grid in this article.