ワークシートで Cells の範囲を移動
Contents
[
Hide
]
この記事では、ワークシート内のセル範囲を移動する方法について説明します。
ワークシートで Cells の範囲を移動
サンプル コードでは、テンプレート ファイルを使用してタスクを示します。
入力ファイル
範囲 A1:B5 が C1:D5 に移動された次の生成ファイルを参照してください。
出力ファイル
This file contains hidden or 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"); |