非連続範囲の実装
Contents
[
Hide
]
通常、名前付き範囲は、連続して隣接するセルで矩形状になります。しかし、隣接していないセルで非連続のセル範囲を使用する必要があることがあります。Aspose.Cellsは隣接していないセルで名前付き範囲を作成することをサポートしています。これには、APIがName.RefersToプロパティを提供しています。
非連続範囲を実装するJavaコード
以下のコードサンプルは、Aspose.Cells for Javaを持つ名前付き非連続範囲を作成する方法を示しています。
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(ImplementingNonSequentialRanges.class); | |
// Instantiating a Workbook object | |
Workbook workbook = new Workbook(); | |
// Adding a Name for non sequenced range | |
int index = workbook.getWorksheets().getNames().add("NonSequencedRange"); | |
Name name = workbook.getWorksheets().getNames().get(index); | |
// Creating a non sequence range of cells | |
name.setRefersTo("=Sheet1!$A$1:$B$3,Sheet1!$D$5:$E$6"); | |
// Save the workbook | |
workbook.save(dataDir + "dest.xls"); |