I use Aspose.Cells to create excel file.
Actually I'm trying to save xls file on the disk and I can't resolve this problem. This is my get method.
[Route("xls")]
[HttpGet]
public HttpResponseMessage Export()
{
try
{
string dataDir = KnownFolders.GetPath(KnownFolder.Downloads);
//var workbook = TransferService.Export(); //TODO get xml
Workbook workbook = new Workbook();
var stream = workbook.SaveToStream();
// I need save this workbook
return Request.CreateResponse(HttpStatusCode.OK); //it's not important here
}
catch (Exception ex)
{
return Request.CreateResponse(HttpStatusCode.InternalServerError); //it's not important here
}
}
Also I have function which is called onClick
function exportToXls() {
$.get(exportURI, function (response) {
return response;
});
}
When someone clicks it should save the file on his disk(or open browser where I could choose the place and name). How to solve this?