Insertar Filas y Columnas
Contents
[
Hide
]
Este tema explica cómo insertar nuevas filas y columnas en una hoja de cálculo utilizando la API Aspose.Cells.GridWeb. Las filas o columnas se pueden insertar en cualquier posición de la hoja de cálculo.
Inserción de Filas
Para insertar una fila en cualquier posición de una hoja de cálculo:
- Agrega el control Aspose.Cells.GridWeb al Formulario Web.
- Acceda a la hoja de cálculo a la que está agregando filas.
- Inserte una fila especificando un índice de fila donde se insertará la fila.
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 reference of the worksheet that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Get row index entered by user | |
int rowIndex = Convert.ToInt16(txtRowIndex.Text.Trim()); | |
// Add row at specified index | |
sheet.Cells.InsertRow(rowIndex); |
Inserción de Columnas
Para insertar una columna en cualquier posición de una hoja de cálculo:
- Agregue el control Aspose.Cells.GridWeb a un Formulario Web.
- Acceda a la hoja de cálculo a la que está agregando columnas.
- Inserte una columna especificando el índice de columna donde se insertará la columna.
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 reference of the worksheet that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Get column index entered by user | |
int columnIndex = Convert.ToInt16(txtColumnIndex.Text.Trim()); | |
// Add column at specified index | |
sheet.Cells.InsertColumn(columnIndex); |
También puede utilizar los métodos InsertarFilas/InsertarColumnas para insertar múltiples filas/columnas en las hojas de cálculo correspondientemente.