Change Font and Color of a Cell
Contents
[
Hide
]
In this topic, we will discuss about changing the font and font color of a cell in GridDesktop. This feature provides more in depth control of worksheets to developers. Using this feature, developers can customize the font and color of any desired cell.
Changing the Font & Color of a Cell
To change the font and color of a cell using Aspose.Cells.GridDesktop, please follow the steps below:
- Access any desired Worksheet
- Access a Cell whose font and color are to be changed
- Create a customized Font
- Set the Font of the Cell to the customized one
- Finally, set Font Color of the Cell to any desired Color
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
// Accessing the worksheet of the Grid that is currently active | |
Worksheet sheet = gridDesktop1.GetActiveWorksheet(); | |
// Accessing a cell using its name | |
GridCell cell = sheet.Cells["A1"]; | |
// Creating a customized Font object | |
Font font = new Font("Arial", 10, FontStyle.Bold); | |
// Setting the font of the cell to the customized Font object | |
cell.SetFont(font); | |
// Setting the font color of the cell to Blue | |
cell.SetFontColor(Color.Blue); |
If you only need to get information about the font or font color of the cell then you can also use GetFont and GetFontColor methods of the cell.