如何实现头部粗体或者不同的颜色的
qcjxberin opened this issue · comments
qcjxberin commented
如何实现头部粗体或者不同的颜色的
Weihan Li commented
暂时不支持样式配置
Weihan Li commented
新发布了一个预览版 1.16.0-preview-20210306-055310,写了一个简单的示例,可以参考:
var setting = FluentSettings.For<TestEntity>();
// ExcelSetting
setting.HasAuthor("WeihanLi")
.HasTitle("WeihanLi.Npoi test")
.HasDescription("WeihanLi.Npoi test")
.HasSubject("WeihanLi.Npoi test");
setting.HasSheetSetting(config =>
{
config.StartRowIndex = 1;
config.SheetName = "SystemSettingsList";
config.AutoColumnWidthEnabled = true;
config.RowAction = row =>
{
if (row.RowNum == 0)
{
var style = row.Sheet.Workbook.CreateCellStyle();
style.Alignment = HorizontalAlignment.Center;
var font = row.Sheet.Workbook.CreateFont();
font.FontName = "JetBrains Mono";
font.IsBold = true;
font.FontHeight = 200;
style.SetFont(font);
row.Cells.ForEach(c => c.CellStyle = style);
}
};
});
//...
Weihan Li commented