Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用SoftArtisans OfficeWriter自定义标题名称?_C#_Excel - Fatal编程技术网

C# 使用SoftArtisans OfficeWriter自定义标题名称?

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

我正在使用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/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.