Inserisci righe e colonne
Contents
[
Hide
]
Questo argomento spiega come inserire nuove righe e colonne in un foglio di lavoro usando Aspose.Cells.GridWeb API. Righe o colonne possono essere inserite in qualsiasi posizione nel foglio di lavoro.
Inserimento di righe
Per inserire una riga in qualsiasi posizione in un foglio di lavoro:
- Aggiungere il controllo Aspose.Cells.GridWeb al Web Form.
- Accedi al foglio di lavoro a cui stai aggiungendo righe.
- Inserire una riga specificando un indice di riga in cui verrà inserita la riga.
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); |
Inserimento di colonne
Per inserire una colonna in qualsiasi posizione in un foglio di lavoro:
- Aggiungere il controllo Aspose.Cells.GridWeb a un Web Form.
- Accedi al foglio di lavoro a cui stai aggiungendo colonne.
- Inserire una colonna specificando l’indice di colonna in cui verrà inserita la colonna.
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); |
È inoltre possibile utilizzare i metodi InsertRows/InsertColumns per inserire più righe/colonne nei fogli di lavoro di conseguenza.