We are building an application where in user will be able to export a list containing data using aspose.cells .NET.
What I have achieved so far is that, I have been able to get the data, transform, filter and write it physically to an excel file (thanks to easily consumable aspose libraries.
Our application’s design is as follows :
- An XHR request hits the RESTful service (.NET WebAPI 2).
- The service calls a business component which first gathers data from database and then passes it to a library that performs the job of transforming the data and filtering it.
- The result data is then sent to another library which implements Strategy pattern as follows:
----An object is instantiated based on what type of export is expected viz. Excel or Pdf
----The result set is passed to an export method of the instantiated object that will generate excel or pdf and return a response.
What I need to do is :
I want the method that generates the excel and pdf file to return HttpResponseMessage that I can blindly return to the client and then the client can interpret the response type and download a file physically.
Also, to add, I tried certain ways to do it, my browser keeps giving me CORS error. I also tried adding allow-access-origin for content disposition to header, but no luck,
Please help! Any guidance will be greatly appreciated. I have lost my depth here.