Hi
I am using Aspose Cells to read a DataReader into an Excel 2007 file and then stream to the user (instead of saving the file to the server).
I have it working, however, on large amounts of Data, it seems that the ImportDataReader takes too much time and things time out.
Here is the function that returns the stream of xlsx file:
Dim workbook As Workbook
workbook = New Workbook(FileFormatType.Xlsx)
Dim worksheet = workbook.Worksheets(0)
worksheet.Cells.ImportDataReader(DirectCast(DirectCast(dr, RefCountingDataReader).InnerReader, System.Data.SqlClient.SqlDataReader), 0, 0, False)
Dim ms As New System.IO.MemoryStream
workbook.Save(ms, SaveFormat.Xlsx)
ms.Seek(0, SeekOrigin.Begin)
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache)
HttpContext.Current.Response.ContentType = Enums.GetDescription(_mimeType)
HttpContext.Current.Response.AppendHeader(“Content-Disposition”, String.Format(“attachment; filename={0}{1}”, _fileName, If(Path.HasExtension(_fileName), “”, Enums.GetDescription(_fileExportFormat))))
HttpContext.Current.Response.Charset = “”
HttpContext.Current.Response.BinaryWrite(ms.ToArray())
…close response
My question is, is there a way with Aspose to stream the xlsx file as it is being created? This would allow the code to begin streaming before the whole entire datareader is imported into the workbook.
Thanks for all your help!
Daniel