Ändra teckensnitt och färg för en rad eller kolumn

Ändra teckensnitt och färg för en kolumn

För att ändra teckensnitt och färg på en kolumn med Aspose.Cells.GridDesktop, följ stegen nedan:

  • Få åtkomst till alla önskadeArbetsblad
  • Tillgång aKolumn vars teckensnitt och färg ska ändras
  • Skapa en anpassadFont
  • Ställ inFont avKolumn till den skräddarsydda
  • Slutligen, ställ inFontfärg avKolumn till någon önskadFärg
 //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);

Ändra teckensnitt och färg på en rad

  • Få åtkomst till alla önskadeArbetsblad
  • Tillgång aRad vars teckensnitt och färg ska ändras
  • Skapa en anpassadFont
  • Ställ inFont avRad till den skräddarsydda
  • Slutligen, ställ inFontfärg avRad till någon önskadFärg
 //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);