Implementazione di intervalli non sequenziali
Contents
[
Hide
]
Normalmente,intervalli denominati sono rettangolari con celle continue e adiacenti l’una all’altra. Ma a volte, potrebbe essere necessario utilizzare un intervallo di celle non sequenziale in cui le celle non sono adiacenti. Aspose.Cells supporta la creazione di un intervallo denominato con celle non adiacenti. Per questo, lo API fornisce ilName.RefersTo proprietà.
Java codice per implementare intervalli non sequenziali
L’esempio di codice seguente mostra come creare un intervallo non sequenziale denominato con 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"); |