MiniExcel icon indicating copy to clipboard operation
MiniExcel copied to clipboard

Freeze top row

Open stian-bay opened this issue 1 year ago • 0 comments

Excel Type

  • [x] XLSX
  • [ ] XLSM
  • [ ] CSV
  • [ ] OTHER

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"
};

stian-bay avatar Jun 26 '24 08:06 stian-bay