Unisci e separa Cells
Contents
[
Hide
]
Aspose.Cells.GridWeb ha una pratica funzione di utilità che ti consente di unire le celle in una cella grande. In questo argomento viene descritto come unire le celle a livello di codice.
Fusione Cells
Unisci più celle in un foglio di lavoro in una singola cella chiamando il metodo Merge della raccolta Cells. Specificare l’intervallo di celle da unire quando si chiama il metodo Merge.
Se unisci più celle e ogni cella contiene dati, dopo l’unione viene mantenuto solo il contenuto della cella in alto a sinistra nell’intervallo. I dati nelle altre celle non vengono persi. Se dividi le celle, ogni cella recupera i propri dati.
Quattro celle unite in una
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 reference of the worksheet that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Merging cells starting from the cell with 3rd row and 3rd column. | |
// 2 rows and 2 columns will be merged from the starting cell | |
sheet.Cells.Merge(2, 2, 2, 2); |
Disaggregabile Cells
Per separare le celle, utilizzare il metodo UnMerge della raccolta Cells che accetta gli stessi parametri del metodo Merge ed esegue la separazione delle celle.
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 reference of the worksheet that is currently active | |
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex]; | |
// Unmerging cells starting from the cell with 3rd row and 3rd column. | |
// 2 rows and 2 columns will be unmerged from the starting cell | |
sheet.Cells.UnMerge(2, 2, 2, 2); |