I'm trying to download an excel file In my controller I'm doing this:
[HttpGet("downloadExcel")]
public async Task<IActionResult> DownloadExcel()
{
var excel = new DownloadExcel();
var fileMemoryStream = excel.GenerateExcel(await students.GetStudentsExcelDownload());
return File(
fileMemoryStream,
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
String.Concat("Students Excel.xlsx"));
}
And in my TypeScript service I'm doing this:
public async downloadExcel(): Promise<any> {
const response = await this._httpClient.get<any>(`${this.downloadExcel}`);
console.log("RESPONSE", response)
return response;
}
But when I cosole.log the responde is like this:
How can I download the file excel?