The following example shows you how to generate an XLSX workbook in memory. The GetBytes method returns the complete file as a byte array, which is convenient in web applications where the workbook is sent to the client as a download and never stored on disk.
The Save method also accepts any System.IO.Stream, so the workbook can be written directly to a MemoryStream, a response stream or any other destination.