Schriftart und Farbe einer Zeile oder Spalte ändern

Schriftart und Farbe einer Spalte ändern

Um die Schriftart und Farbe einer Spalte mit Aspose.Cells.GridDesktop zu ändern, gehen Sie bitte wie folgt vor:

  • Greifen Sie beliebig zuArbeitsblatt
  • Zugriff aSpalte dessen Schriftart und Farbe geändert werden soll
  • Erstellen Sie eine angepassteSchriftart
  • Stellen Sie die einSchriftart desSpalte zum Maßgeschneiderten
  • Endlich einstellenSchriftfarbe desSpalte zu jedem gewünschtenFarbe
 //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);

Schriftart und Farbe einer Zeile ändern

  • Greifen Sie beliebig zuArbeitsblatt
  • Zugriff aReihe dessen Schriftart und Farbe geändert werden soll
  • Erstellen Sie eine angepassteSchriftart
  • Stellen Sie die einSchriftart desReihe zum Maßgeschneiderten
  • Endlich einstellenSchriftfarbe desReihe zu jedem gewünschtenFarbe
 //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);