替换智能图中的文本

可能的使用场景

智能艺术是工作簿中的一个重要对象。许多时候需要更新智能艺术中的文本。Aspose.Cells通过设置Shape.text属性来提供此功能。

可以从以下链接下载示例源文件:

SmartArt.xlsx

示例代码

from aspose.cells import OoxmlSaveOptions, Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
wb = Workbook(sourceDir + "SmartArt.xlsx")
for worksheet in wb.worksheets:
for shape in worksheet.shapes:
shape.alternative_text = "ReplacedAlternativeText"
if shape.is_smart_art:
for smartart in shape.get_result_of_smart_art().get_grouped_shapes():
smartart.text = "ReplacedText"
options = OoxmlSaveOptions()
options.update_smart_art = True
wb.save(outputDir + "outputSmartArt.xlsx", options)