Combinar y separar Cells
Contents
[
Hide
]
Aspose.Cells.GridWeb tiene una función de utilidad útil que le permite combinar celdas en una celda grande. Este tema describe cómo fusionar celdas mediante programación.
Fusionando Cells
Combine varias celdas en una hoja de trabajo en una sola celda llamando al método Merge de la colección Cells. Especifique el rango de celdas que se combinarán al llamar al método Merge.
Si combina varias celdas y cada celda contiene datos, solo se conserva el contenido de la celda superior izquierda del rango después de la combinación. Los datos en las otras celdas no se pierden. Si separa las celdas, cada celda recupera sus datos.
Cuatro celdas fusionadas en una
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]; | |
// 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); |
Separación Cells
Para separar celdas, use el método UnMerge de la colección Cells que toma los mismos parámetros que el método Merge y realiza la separación de celdas.
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]; | |
// 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); |