Unisci o separa un intervallo di celle
Contents
[
Hide
]
Puoi utilizzare Aspose.Cells per unire o dividere un intervallo di celle. Aspose.Cells fornisce i metodi Range.Merge() e Range.UnMerge() a questo scopo. Questo articolo spiega come unire un intervallo di celle in una singola cella.
Esempio
Il codice di esempio crea prima un intervallo - A1:D4 - quindi unisce le celle nell’intervallo in un’unica cella utilizzando il metodo Range.Merge(). Allo stesso modo, è possibile separare le celle creando un intervallo e chiamando il metodo Range.UnMerge().
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 | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Create a workbook | |
Workbook workbook = new Workbook(); | |
// Access the first worksheet | |
Worksheet worksheet = workbook.Worksheets[0]; | |
// Create a range | |
Range range = worksheet.Cells.CreateRange("A1:D4"); | |
// Merge range into a single cell | |
range.Merge(); | |
// Save the workbook | |
workbook.Save(dataDir+ "output.out.xlsx"); |