ブックおよびワークシートにスコープが制限された名前付き範囲を作成する
Contents
[
Hide
]
Microsoft Excelでは、ワークブック(またはグローバルスコープとしても知られています)とワークシートの2つの異なるスコープで名前付き範囲を定義できます。
- ワークブックスコープの名前付き範囲は、そのワークブック内の任意のワークシートから、名前を単純に使用することでアクセスできます。
- ワークシートスコープの名前付き範囲は、それが作成された特定のワークシートの参照でアクセスされます。
Aspose.Cells for Python via .NET は、ワークブックおよびワークシートのスコープ付き名前付き範囲を追加するために、Microsoft Excel と同じ機能を提供しています。ワークシートスコープの名前付き範囲を作成する場合、ワークシートの参照を使用して、それをワークシートスコープの名前付き範囲として指定する必要があります。
ワークブックスコープの名前付き範囲を追加する方法
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(".") | |
# Create a new Workbook object | |
workbook = Workbook() | |
# Get first worksheet of the workbook | |
sheet = workbook.worksheets[0] | |
# Get worksheet's cells collection | |
cells = sheet.cells | |
# Create a range of Cells from Cell A1 to C10 | |
workbookScope = cells.create_range("A1", "C10") | |
# Assign the nsame to workbook scope named range | |
workbookScope.name = "workbookScope" | |
# Save the workbook | |
workbook.save(dataDir + "WorkbookScope.out.xlsx") |
ワークシートスコープの名前付き範囲を追加する方法
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(".") | |
# Create a new Workbook object | |
workbook = Workbook() | |
# Get first worksheet of the workbook | |
sheet = workbook.worksheets[0] | |
# Get worksheet's cells collection | |
cells = sheet.cells | |
# Create a range of Cells | |
localRange = cells.create_range("A1", "C10") | |
# Assign name to range with sheet raference | |
localRange.name = "Sheet1!local" | |
# Save the workbook | |
workbook.save(dataDir + "ouput.out.xls") |