Establecer el ancho de columna o la altura de fila
Contents
[
Hide
]
Este tema trata sobre la configuración del ancho de columna y el alto de fila mediante Aspose.Cells.GridDesktop API. A veces, las celdas de la hoja de cálculo contienen valores que son más anchos que la celda original. Hace que sea difícil para los usuarios leer el contenido de la celda. A algunos usuarios no les gusta usar la tecla de flecha hacia la derecha para ver el valor completo en una celda. Para resolver tales problemas, los desarrolladores pueden cambiar el ancho de la columna. Cambiar la altura de la fila resuelve problemas similares.
Configuración del ancho de columna
Para configurar el ancho de una columna usando Aspose.Cells.GridDesktop:
- Accede a una hoja de trabajo.
- Acceda a la columna a la que desea cambiar el ancho.
- Establezca el ancho de la columna.
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; |
Configuración de la altura de fila
Para configurar la altura de una fila usando Aspose.Cells.GridDesktop, siga los pasos a continuación:
- Acceda a cualquier hoja de trabajo que desee.
- Acceda a la fila a la que desea cambiar la altura.
- Establezca la altura de la fila.
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; |