Unisci e separa celle

Unione di celle

Unisci più celle in un foglio di lavoro in una singola cella chiamando il metodo Merge della collezione Cells. Specifica l’intervallo delle celle da unire quando si chiama il metodo Merge.

Quattro celle unite in una

todo:image_alt_text

// 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);

Separazione delle celle

Per separare le celle, utilizza il metodo UnMerge della collezione Cells che accetta gli stessi parametri del metodo Merge e esegue la separazione delle celle.

// 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);