实现非连续范围
Contents
[
Hide
]
可能的使用场景
通常,命名范围是连续和相邻的矩形单元格。但有时候,您可能需要使用非连续的单元范围,其中单元格不相邻。Aspose.Cells for Python via .NET 支持创建具有非相邻单元格的命名范围。
如何使用 Aspose.Cells for Python Excel Library 添加非连续范围
下面的代码示例显示了如何使用 Aspose.Cells for Python via .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
from aspose.cells import Workbook | |
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET | |
# The path to the documents directory. | |
dataDir = RunExamples.GetDataDir(".") | |
# Instantiating a Workbook object | |
workbook = Workbook() | |
# Adding a Name for non sequenced range | |
index = workbook.worksheets.names.add("NonSequencedRange") | |
name = workbook.worksheets.names[index] | |
# Creating a non sequence range of cells | |
name.refers_to = "=Sheet1!$A$1:$B$3,Sheet1!$E$5:$D$6" | |
# Save the workbook | |
workbook.save(dataDir + "Output.out.xlsx") |