I want to export my data to excel or pdf but then it's not working in IE. I tried to export it in Chrome and its working fine. But most of the people who'll use my project are using internet explorer. Can anyone take a look on my codes and maybe suggest me what to do ?
Here's my Angular function :
scope.exportData = function () {
var date = new Date();
var d = date.getFullYear() + '-' + date.getMonth() + 1 + '-' + date.getDate();
var blob = new Blob([document.getElementById('exportable').innerHTML], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
});
saveAs(blob, "Report_" + d + ".xls");
};
scope.exportDataItems = function () {
var date = new Date();
var d = date.getFullYear() + '-' + date.getMonth() + 1 + '-' + date.getDate();
var blob = new Blob([document.getElementById('exportablePRItems').innerHTML], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
});
saveAs(blob, "Items_"+ d +".xls");
};
}]);
I am actually using Blob.js.
Maybe this would be of a little help. :)
scope.exportDataNew = function () {
var d = new Date();
var mont = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
if (typeof scope.filter_fromDate == 'undefined') {
scope.filter_fromDate = mont[d.getMonth()] + ' ' + d.getDate().toString() + ", " + d.getFullYear().toString();
}
if (typeof scope.filter_toDate == 'undefined') {
scope.filter_toDate = mont[d.getMonth()] + ' ' + d.getDate().toString() + ", " + d.getFullYear().toString();
}
if (typeof scope.EntityID == 'undefined') {
scope.EntityID = "";
}
if (typeof scope.DepartmentID == 'undefined') {
scope.DepartmentID = "";
}
location.href = 'ExportExcel?from=' + scope.filter_fromDate + '&to=' + scope.filter_toDate + '&EntityID=' + scope.EntityID + '&DepartmentID=' + scope.DepartmentID;
};
scope.exportData = function () {
var date = new Date();
var d = date.getFullYear() + '-' + date.getMonth() + 1 + '-' + date.getDate();
var blob = new Blob([document.getElementById('exportable').innerHTML], {
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"
});
saveAs(blob, "Report_" + d + ".xls");
};