实现非连续范围
Contents
[
Hide
]
通常,命名范围是连续和相邻的单元格组成的矩形。但有时,您可能需要使用一个非连续的单元格范围,其中单元格不是相邻的。Aspose.Cells支持创建具有非相邻单元格的命名范围。
下面的代码示例显示如何使用 Aspose.Cells for .NET 创建命名的非连续范围。
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-.NET | |
// The path to the documents directory. | |
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | |
// Instantiating a Workbook object | |
Workbook workbook = new Workbook(); | |
// Adding a Name for non sequenced range | |
int index = workbook.Worksheets.Names.Add("NonSequencedRange"); | |
Name name = workbook.Worksheets.Names[index]; | |
// Creating a non sequence range of cells | |
name.RefersTo = "=Sheet1!$A$1:$B$3,Sheet1!$D$5:$E$6"; | |
// Save the workbook | |
workbook.Save(dataDir+ "Output.out.xlsx"); |