Изменение шрифта и цвета строки или столбца

Изменение шрифта и цвета столбца

Чтобы изменить шрифт и цвет столбца с помощью 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);