2
// If Internet Explorer
if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./)) {
    txtArea1.document.open("txt/html", "replace");
    txtArea1.document.write(tab_text);
    txtArea1.document.close();
    txtArea1.focus();
    sa = txtArea1.document.execCommand("SaveAs", true, tableid + fileNo + ".xls");
}
else
    sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));

return (sa);

in above code,when dialog box is showing ,there is .xls not in save as type. so please tell me how .xls save as type can be add in dropdown

1 Answers1

0

I'm in agreement with @RoryMcCrossan - client scripting cannot affect the browser's 'Save As' dialog box.

If you want users to see that file type, when a user clicks your hyperlink, it should make a request to the server. Then, on the server, you have to generate the .xls file (or filestream in memory) and send the response back using the application/vnd.ms-excel bit you mentioned in your header.

Here's what that looks like: (SO answer using classic asp)

Community
  • 1
  • 1
bkwdesign
  • 1,953
  • 2
  • 28
  • 50