C# 使用SoftArtisans OfficeWriter自定义标题名称?
我正在使用SoftArtisans OfficeWriter工具创建excel文件。 通过使用DataImportProperties.UseColumnNames=true,列标题用类属性名填充,但我想提供自定义列标题。 有什么建议吗C# 使用SoftArtisans OfficeWriter自定义标题名称?,c#,excel,C#,Excel,我正在使用SoftArtisans OfficeWriter工具创建excel文件。 通过使用DataImportProperties.UseColumnNames=true,列标题用类属性名填充,但我想提供自定义列标题。 有什么建议吗 Donot use DataImportProperties.UseColumnNames=true.Instead use cell specific formatting since it is header so for every cell row/co
Donot use DataImportProperties.UseColumnNames=true.Instead use cell specific formatting since it is header so for every cell row/column number is known.ex.
Style headerStyle = wb.CreateStyle();
headerStyle.Font.Size = 10;
headerStyle.Font.Bold = true;
ws.Cells[1, 0].Value = "Name";
ws.Cells[1, 0].ApplyStyle(headerStyle);
You can also merge and group columns as :
ws[0, 0].Value = "Information";
Palette pal = wb.Palette;
Color group1Color = pal.GetClosestColor(255, 244, 205);
headerStyle.BackgroundColor = group1Color;
headerStyle.Font.Bold = true;
ws[0, 0].ApplyStyle(headerStyle);
ws.CreateArea(0, 0, 1, 13).MergeCells();
ws.GroupColumns(0, 12, true);
//True/false keeps the group collapsed/uncollpasedwhen user opens the workbook.