Taglia e Incolla Range
Contents
[
Hide
]
Taglia e Incolla Celle
Aspose.Cells ti consente di tagliare e incollare celle all’interno di un foglio di lavoro utilizzando il metodo insertCutCells della collezione Cells. Il insertCutCells accetta i seguenti parametri.
- Range: L’intervallo di celle da tagliare.
- Indice riga: L’indice della riga in cui inserire le celle.
- Indice colonna: L’indice della colonna in cui inserire le celle.
- ShiftType: La direzione di spostamento delle colonne.
L’esempio seguente mostra come tagliare e incollare celle all’interno di un foglio di lavoro.
Codice di esempio
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-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getSharedDataDir(CountNumberOfCells.class) + "Worksheets/"; | |
// Instantiating a Workbook object | |
Workbook workbook = new Workbook(); | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
worksheet.getCells().get(0, 2).setValue(1); | |
worksheet.getCells().get(1, 2).setValue(2); | |
worksheet.getCells().get(2, 2).setValue(3); | |
worksheet.getCells().get(2, 3).setValue(4); | |
worksheet.getCells().createRange(0, 2, 3, 1).setName("NamedRange"); | |
Range cut = worksheet.getCells().createRange("C:C"); | |
worksheet.getCells().insertCutCells(cut, 0, 1, ShiftType.RIGHT); | |
workbook.save(dataDir + "CutAndPasteCells.xlsx"); |