创建联合范围
Contents
[
Hide
]
创建联合范围
Aspose.Cells提供了使用WorksheetCollection.create_union_range方法创建Union Range的能力。 WorksheetCollection.create_union_range方法接受两个参数,用于创建Union Range的地址和工作表的索引。WorksheetCollection.create_union_range方法返回一个UnionRange对象。
以下代码片段演示了如何使用WorksheetCollection.create_union_range方法创建Union Range。代码生成的输出文件已附上以供参考。
This file contains hidden or 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 | |
# Instantiating a Workbook object | |
workbook = Workbook() | |
# Create union range | |
unionRange = workbook.worksheets.create_union_range("sheet1!A1:A10,sheet1!C1:C10", 0) | |
# Put value "ABCD" in the range | |
unionRange.value = "ABCD" | |
# Save the output workbook. | |
workbook.save("CreateUnionRange_out.xlsx") |