Start Column format at a specife row

I have a Excel I am trying to create with specific format.  So my last column I have formatted for currency.

 IStyle dollarStyle = workbook.Styles.Add("DollarStyle");

 dollarStyle.NumberFormat = "$#,##0.00";

 worksheet.SetDefaultColumnStyle(7, dollarStyle);


But I formatted a few rows in the header section for a specific format

IStyle tableHeaderStyle = workbook.Styles.Add("TableHeaderStyle");

tableHeaderStyle.Font.Bold = true;

tableHeaderStyle.Color = System.Drawing.Color.LightGray;

tableHeaderStyle.Borders[ExcelBordersIndex.EdgeBottom].LineStyle = ExcelLineStyle.Thin;

worksheet.Range["A8:G8"].CellStyle = tableHeaderStyle;

 

The problem is the colum format over rides the row format.  I have tried changing order but no success.

Is there a way to start the column format at row 8?



1 Reply

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team June 28, 2021 12:40 PM UTC

Hi Eric, 

Greetings from Syncfusion. 

We have tried both the mentioned cases and both the cases seems to be working fine. We have checked the issue in 19.1.0.54 version of Syncfusion XlsIO. The sample which we have tried at our end can be downloaded from the below link. 


Cases Tried: 
  1. Apply dollar style to column 7 first and then apply table header style for A8:G8 row.
Output: Entire Column G will have the dollar style applied except G8 cell. 
  1. Apply table header style for A8:G8 row first and the apply dollar style for Column 7.
Output: Entire Column G will have the dollar style applied. 

We have copied the output files into Output folder for your reference. Please try the sample and let us know if this helps. If the issue still persists, kindly modify and share the issue reproducing sample, which will be helpful for us in investigating the query ad provide prompt solution at the earliest. 

Regards, 
Keerthi. 


Loader.
Up arrow icon