Bereich von Zellen in einem Arbeitsblatt verschieben
Contents
[
Hide
]
In diesem Artikel wird gezeigt, wie man einen Bereich von Zellen in einem Arbeitsblatt verschiebt.
Bereich von Zellen in einem Arbeitsblatt verschieben
Der Beispielcode verwendet eine Vorlagendatei, um die Aufgabe zu demonstrieren.
Die Eingabedatei
Bitte sehen Sie die folgende generierte Datei mit dem Bereich A1:B5, der nach C1:D5 verschoben wurde.
Die Ausgabedatei
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.getDataDir(MoveRangeOfCellsInWorksheet.class); | |
// Instantiate the workbook object. Open the Excel file | |
Workbook workbook = new Workbook(dataDir + "book1.xls"); | |
Cells cells = workbook.getWorksheets().get(0).getCells(); | |
// Create Cell's area | |
CellArea ca = CellArea.createCellArea("A1", "B5"); | |
// Move Range | |
cells.moveRange(ca, 0, 2); | |
// Save the resultant file | |
workbook.save(dataDir + "book2.xls"); |