forked from christophano/CsvHelper.Excel
-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
Hi, I'm unable to get the bytes of the xlsx file from the MemoryStream. the code in approach 1 generates the file but in approach 2 I get always an empty byte[]. What I'm missing here? thanks!
Approach 1:
using (var writer = new ExcelWriter("test_123.xlsx"))
{
writer.WriteRecords(sections.ToList());
}
Approach 2:
using var stream = new MemoryStream();
using var writer = new ExcelWriter(stream, CultureInfo.InvariantCulture);
{
writer.WriteRecords(sections.ToList());
}
var data = stream.ToArray();
var fileName = $"{DateTime.UtcNow.ToStandardFullFormat()}.{FileExtensions.XLSX}";
return new DataFile(fileName, ContentTypes.XLSX, FileType, data);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels