通过指定数据范围和 Sparkline 组的位置来复制 Sparkline
Contents
[
Hide
]
微软Excel允许通过指定数据范围和位置复制迷你图。Aspose.Cells for Python via .NET支持此功能。
在Microsoft Excel中复制火花线到其他单元格:
- 选择包含火花线的单元格。
- 从设计选项卡的火花线部分选择编辑数据。
- 选择编辑组位置和数据。
- 指定数据范围和位置。
- 点击确定。
Aspose.Cells for Python via .NET提供了SparklineCollection.Add(dataRange, row, column)方法,用于指定迷你图组的数据范围和位置。以下示例代码加载上方截图中的源Excel文件,然后访问第一个迷你图组,添加数据范围和位置,最后将结果Excel文件保存到磁盘。
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 | |
# 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 workbook from source Excel file | |
workbook = Workbook(dataDir + "source.xlsx") | |
# Access first worksheet | |
worksheet = workbook.worksheets[0] | |
# Access the first sparkline group | |
group = worksheet.sparkline_groups[0] | |
# Add Data Ranges and Locations inside this sparkline group | |
group.sparklines.add("D5:O5", 4, 15) | |
group.sparklines.add("D6:O6", 5, 15) | |
group.sparklines.add("D7:O7", 6, 15) | |
group.sparklines.add("D8:O8", 7, 15) | |
# Save the workbook | |
workbook.save(dataDir + "output_out.xlsx") |