Spaltenbreite oder Zeilenhöhe einstellen
Contents
[
Hide
]
In diesem Thema wird das Festlegen der Spaltenbreite und Zeilenhöhe mit Aspose.Cells.GridDesktop API erläutert. Manchmal enthalten Arbeitsblattzellen Werte, die breiter als die ursprüngliche Zelle sind. Es erschwert Benutzern das Lesen des Zelleninhalts. Einige Benutzer verwenden nicht gerne die rechte Pfeiltaste, um den vollständigen Wert in einer Zelle anzuzeigen. Um solche Probleme zu lösen, können Entwickler die Spaltenbreite ändern. Das Ändern der Zeilenhöhe löst ähnliche Probleme.
Spaltenbreite einstellen
So legen Sie die Breite einer Spalte mit Aspose.Cells.GridDesktop fest:
- Greifen Sie auf ein Arbeitsblatt zu.
- Greifen Sie auf die Spalte zu, deren Breite Sie ändern möchten.
- Legen Sie die Spaltenbreite fest.
This file contains hidden or 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(); | |
// Adding sample value to sheet cell | |
GridCell cell = sheet.Cells["a1"]; | |
cell.SetCellValue("Welcome to Aspose!"); | |
// Accessing the first column of the worksheet | |
Aspose.Cells.GridDesktop.Data.GridColumn column = sheet.Columns[0]; | |
// Setting the width of the column | |
column.Width = 150; |
Zeilenhöhe einstellen
Um die Höhe einer Zeile mit Aspose.Cells.GridDesktop festzulegen, gehen Sie bitte wie folgt vor:
- Greifen Sie auf jedes gewünschte Arbeitsblatt zu.
- Greifen Sie auf die Zeile zu, deren Höhe Sie ändern möchten.
- Legen Sie die Zeilenhöhe fest.
This file contains hidden or 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(); | |
// Adding sample value to sheet cells | |
GridCell cell = sheet.Cells["b2"]; | |
cell.SetCellValue("1"); | |
cell = sheet.Cells["c2"]; | |
cell.SetCellValue("2"); | |
cell = sheet.Cells["d2"]; | |
cell.SetCellValue("3"); | |
cell = sheet.Cells["e2"]; | |
cell.SetCellValue("4"); | |
// Accessing the first row of the worksheet | |
Aspose.Cells.GridDesktop.Data.GridRow row = sheet.Rows[1]; | |
// Setting the height of the row | |
row.Height = 100; |