Ställa in kolumnbredd eller radhöjd
Contents
[
Hide
]
Det här ämnet diskuterar inställning av kolumnbredd och radhöjd med hjälp av Aspose.Cells.GridDesktop API. Ibland innehåller kalkylbladsceller värden som är bredare än den ursprungliga cellen. Det gör det svårt för användare att läsa cellinnehållet. Vissa användare gillar inte att använda högerpilen för att se hela värdet i en cell. För att lösa sådana problem kan utvecklare ändra kolumnbredden. Att ändra radhöjden löser liknande problem.
Ställa in kolumnbredd
Så här ställer du in bredden på en kolumn med Aspose.Cells.GridDesktop:
- Få tillgång till ett arbetsblad.
- Gå till kolumnen du vill ändra bredden på.
- Ställ in kolumnbredden.
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; |
Ställa in radhöjd
För att ställa in höjden på en rad med Aspose.Cells.GridDesktop, följ stegen nedan:
- Få åtkomst till valfritt kalkylblad.
- Gå till raden du vill ändra höjden på.
- Ställ in radhöjden.
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; |