I have a jquerry function to make expert to excel and it is working also but when i download it saved in a name like Download,Download(1) as on. But i want to give a specific name of it as consolidated report
Bellow is my code:
Sys.Application.add_load(function () {
$('[id*=img_export]').on('click', function () {
ExportToExcel('grdConsolidated');
location.reload();
});
});
function ExportToExcel(Id) {
var msg = $('[id*=lblmsg]').text();
// alert(msg);
var tab_text = "
";
| " + msg + " | |||||||||||||||
tab_text = tab_text.replace(/]*>|<\/A>/g, ""); //remove if u want links in your table
tab_text = tab_text.replace(/
]*>/gi, ""); // remove if u want images in your table
tab_text = tab_text.replace(/]*>|<\/input>/gi, ""); // reomves input params
var ua = window.navigator.userAgent;
var msie = ua.indexOf("MSIE ");
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) // If Internet Explorer
{
txtArea1.document.open("txt/html", "replace");
txtArea1.document.write(tab_text);
txtArea1.document.close();
txtArea1.focus();
sa = txtArea1.document.execCommand("SaveAs", true, Id + "ConsolidatedReport.xls");
}
else { //other browser not tested on IE 11
sa = window.open('data:application/ConsolidatedReport.ms-excel,' + encodeURIComponent(tab_text));
}
return (sa);
}
Sonasri TripathyPosted May 4, 2017, 3:13 AM
Shakti Singh DulawatPosted Apr 30, 2017, 9:21 AM