更改行或列的字体和颜色

更改列的字体和颜色

要使用 Aspose.Cells.GridDesktop 更改列的字体和颜色,请按照以下步骤操作:

  • 访问任何想要的工作表
  • 访问一个柱子要更改其字体和颜色
  • 创建自定义字体
  • 设置字体柱子到定制的
  • 最后,设置字体颜色柱子任何想要的颜色
 //Accessing the worksheet of the Grid that is currently active

Worksheet sheet = gridDesktop1.GetActiveWorksheet();

//Accessing the first column of the worksheet

GridColumn column = sheet.Columns[0];

//Creating a customized Font object

Font font = new Font("Arial", 10, FontStyle.Bold);

//Setting the font of the column to the customized Font object

column.SetFont(font);

//Setting the font color of the column to Blue

column.SetFontColor(Color.Blue);

更改一行的字体和颜色

  • 访问任何想要的工作表
  • 访问一个要更改其字体和颜色
  • 创建自定义字体
  • 设置字体到定制的
  • 最后,设置字体颜色任何想要的颜色
 //Accessing the worksheet of the Grid that is currently active

Worksheet sheet = gridDesktop1.GetActiveWorksheet();

//Accessing the first row of the worksheet

GridRow row = sheet.Rows[0];

//Creating a customized Font object

Font font = new Font("Arial", 10, FontStyle.Underline);

//Setting the font of the column to the customized Font object

row.SetFont(font);

//Setting the font color of the column to Green

row.SetFontColor(Color.Green);