Click here to Skip to main content
15,890,512 members

Comments by Himansh jain (Top 32 by date)

Himansh jain 27-Sep-22 0:51am View    
I am sorry, I will try to be more clear from the next time.
Himansh jain 20-Sep-22 7:50am View    
Sir, actually when I am directly hitting the API, I am able to view the file .
But when I am hitting it from UI

$scope.download = function (fileName) {
debugger
if (fileName != null && fileName != '' && fileName != undefined) {
URIService.GetData(URIService.GetDownloadExcelFileUrl(fileName))
.success(function (data) {
var file = new Blob([data], {
type: 'application/vnd.ms-excel'
});
FileSaver.saveAs(file, fileName, true); //I need help over this piece of code , when the data is being returned from api , while saving that data..format issue arises.

}).error(function (data, status, headers, config) {
var errorMessage = "";
if (status == "404" || data == undefined) {
errorMessage = "Menu.FileNotFound"
}
else {
errorMessage = "Menu.Error_Message"
}
});
Himansh jain 20-Sep-22 7:41am View    
you can try putting null check
Himansh jain 20-Sep-22 7:29am View    
But Through directly hitting the API I am able to download the xls file correctly.
Only when I am hitting API through the angularjs code, i am seeing this. So the issue must be with angularjs code.
Himansh jain 20-Sep-22 7:20am View    
Sir, can you please debug this code..I am not able to download the correct file.
Please refer to the question below.

https://www.codeproject.com/Questions/5342610/How-do-I-download-a-file-in-xls-format