mini-software / MiniExcel

Fast, Low-Memory, Easy Excel .NET helper to import/export/template spreadsheet (support Linux, Mac)
https://www.nuget.org/packages/MiniExcel/
Apache License 2.0
2.81k stars 342 forks source link

Freeze top row #620

Closed stian-bay closed 4 months ago

stian-bay commented 5 months ago

Excel Type

MiniExcel Version

Description

The autofilter and table style is really nice and it would be perfect if you could also add the posibility to freeze the top row. This makes it easier for the customer when working with large data sets.

And you can set it with either config or model spesific [ExcelSheet(Name = "Data", FreezeTopRow = true)]

var config = new OpenXmlConfiguration()
{
    TableStyles = TableStyles.Default,
    AutoFilter = true,
    FreezeTopRow = true,
};

Although sidenote, I noticed it doesn't pick up the sheet name I set on top of the DataModelExport class if I use it like this:

var data = dbItems.Adapt<IEnumerable<DataModelExport>>();

var memoryStream = new MemoryStream();
memoryStream.SaveAs(data);
memoryStream.Seek(0, SeekOrigin.Begin);

return memoryStream;
var fileStream = excelService.Export(key);

return new FileStreamResult(fileStream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
{
    FileDownloadName = $"Exported items - {DateTime.Now:dd.MM.yyyy HH:mm}.xlsx"
};