Ändra teckensnitt och färg för en Cell
Contents
[
Hide
]
I det här ämnet kommer vi att diskutera hur man ändrar teckensnitt och teckensnittsfärg för en cell. Den här funktionen ger utvecklare mer djupgående kontroll av kalkylblad. Med den här funktionen kan utvecklare anpassa teckensnittet och färgen på valfri cell.
Ändra teckensnitt och färg för en Cell
För att ändra teckensnitt och färg på en cell med Aspose.Cells.GridDesktop, följ stegen nedan:
- Få åtkomst till alla önskadeArbetsblad
- Tillgång aCell vars teckensnitt och färg ska ändras
- Skapa en anpassadFont
- Ställ inFont avCell till den skräddarsydda
- Slutligen, ställ inFontfärg avCell till någon önskadFärg
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); |
Om du bara behöver få information om cellens typsnitt eller teckensnittsfärg så kan du också användaGetFont ochGetFontColor cellens metoder.