Xls Binary Structure

It's not a specific angular issue btw, it's the same in vanilla js or jquery, only the xmlhttprequest is wrapped differently –  Jorg Mar 17 '14 at 7:41. Just noticed you can't use it because of IE8/9 but I'll push submit anyway. maybe someone finds it usefulThis can actually be done through the browser, using blob. Notice the responseType and the code in the success promise.$http({ url: 'your/webservice', method: "POST", data: json, //this is your json data string headers: { 'Content-type': 'application/json' }, responseType: 'arraybuffer'}).success(function (data, status, headers, config) { var blob = new Blob([data], {type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}); var objectUrl = URL.createObjectURL(blob); window.open(objectUrl);}).error(function (data, status, headers, config) { //upload failed});There are some problems with it though like:. I think in many cases it wont work. U need to set content type of $http to 'blob'. –  user2171669 Nov 10 '14 at 12:28. HTML5 saveAs is used to save the actual data to your wanted format. Note it will still work without adding type in this case. $http({ url: 'your/webservice', method: 'POST', responseType: 'arraybuffer', data: json, //this is your json data string headers: { 'Content-type': 'application/json', 'Accept': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }}).success(function(data){ var blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); saveAs(blob, 'File_Name_With_Some_Unique_Id_Time' + '.xlsx');}).error(function(){ //Some error log});Tip! Don't mix " and ', stick to always use ', in a professional environment you will have to pass js validation for example jshint, same goes for using === and not ==, and so on, but that is another topic :)I would put the save excel in another service, so you have clean structure and the post is in a proper service of its own. I can make a JS fiddle for you, if you don't get my example working. Then I would also need some json data from you that you use for a full example.Happy coding. Eduardo. There is no way (to my knowledge) to trigger the download window in your browser from Javascript. The only way to do it is to redirect the browser to a url that streams the file to the browser.If you can modify your REST service, you might be able to solve it by changing so the POST request xls binary structure doesn't respond with the binary file, but with a url to that file. That'll get you the url in Javascript instead of the binary data, and you can redirect the browser to that url, which should prompt the download without leaving the original page.