I would like to apply Font name, color and size to a cell area consists of a single column that starts in a know position like (4,3) and ends at (MaxDataRow,3) . Do you have an example of that?
May the following sample code help you for your need, Kindly consult it
Workbook workbook = new Workbook(); Worksheet worksheet = workbook.Worksheets[0]; Cells cells = worksheet.Cells; //Filling some data into the cells for(int i =0;i<50;i++) { for(int j = 0;j<10;j++) { cells[i,j].PutValue(i.ToString() + "," +j.ToString()); } } //Define a style object adding a new style //to the collection list. Style stl5 = workbook.Styles[workbook.Styles.Add()]; //Set the font name. stl5.Font.Name = "Tahoma"; //Set the font size. stl5.Font.Size = 10; //Set font text color. stl5.Font.Color= Color.Red; //Set the font bold. stl5.Font.IsBold = true; //Set the font italic. stl5.Font.IsItalic = true; //Create the style flag struct and specify which formattings //you want to apply. StyleFlag flag = new StyleFlag(); flag.FontName = true; flag.FontSize = true; flag.FontColor = true; flag.FontBold = true; flag.FontItalic = true;
//Create a range of cells for your need. Range range = workbook.Worksheets[0].Cells.CreateRange(4,3,cells.MaxDataRow-3,1); //Apply the style to cells in the named range. range.ApplyStyle(stl5,flag);