Writing directly to disk?

Jun 6, 2011 at 10:26 AM
Edited Jun 6, 2011 at 10:27 AM

I was wondering if there is a way to stream data directly to disk while populating the excel file.

I  have tried invoking the Flush method over the output stream but with no luck, I had to call Save on the ExcelPackage in order to get some output.

Should I surrender? :)


Thanks, keep up the very good work.

Jun 7, 2011 at 10:10 PM

You can't stream directly to disk since cells, rows and columns are stored in memory. The xml is created and saved to the stream when you call the save method.

I guess you have to surrender this :)


Jun 8, 2011 at 10:45 AM

Thanks for the quick reply.

So the Stream property is a memory stream, but then I don't understand what's the difference between creating a package using a destination FileStream instead of a FileInfo... buffered writing to disk only?

Just curious...



Jun 9, 2011 at 8:08 PM

It's pretty much the same thing. When working with the cells using the Cells property the data is stored internally in a collection class (the RangeCollection class) for faster access and to keep it sorted.

When calling the Save (or SaveAs) method, the data is saved back to the stream. Choose the way you think is the easiest