I want to create a Excel file dynamically in C# and I need to make it as downloadable in AngularJS HTML Button Click.
I referred the following link to create Excel dynamically http://www.increvcorp.com/manipulating-excel-spreadsheet-using-c/
It's working fine. But it saves the file in local storage
xlWorkBook.SaveAs("D:\\Mobile_List.xls", Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);
I referred one more post, they given idea to convert directly from workbook to Memory Stream - Convert excel workbook to byte[].
But, in that post they used the
MemoryStream m = new MemoryStream();
workbook.SaveToStream(m);
I Can't able to find the method SaveToStream
in my workbook, it shows an error
'Microsoft.Office.Interop.Excel.Workbook' does not contain a definition for 'SaveToStream' and no extension method 'SaveToStream' accepting a first argument of type 'Microsoft.Office.Interop.Excel.Workbook' could be found (are you missing a using directive or an assembly reference?)
How could I make it as memory stream and send it back to AngularJS for download by clicking the HTML Button ?
I referred one more post to AngularJS $http-post - convert binary to excel file and download - it purely explained the angularJS part and PHP. There is no explanation for C#, that's the main reason I'm posting this question.
Kindly assist me...
Note: Don't convert it from local storage...