Remplacer le texte dans l art intelligent

Scénarios d’utilisation possibles

L’art intelligent est l’un des principaux objets dans un classeur. Souvent, il est nécessaire de mettre à jour le texte dans l’art intelligent. Aspose.Cells propose cette fonctionnalité en définissant la propriété Shape.Text.

Le fichier source d’exemple peut être téléchargé à partir du lien suivant :

SmartArt.xlsx

Code d’exemple

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
Workbook wb = new Workbook(sourceDir + "SmartArt.xlsx");
foreach (Worksheet worksheet in wb.Worksheets)
{
foreach (Shape shape in worksheet.Shapes)
{
shape.AlternativeText = "ReplacedAlternativeText"; // This works fine just as the normal Shape objects do.
if (shape.IsSmartArt)
{
foreach (Shape smartart in shape.GetResultOfSmartArt().GetGroupedShapes())
{
smartart.Text = "ReplacedText"; // This doesn't update the text in Workbook which I save to the another file.
}
}
}
}
Aspose.Cells.OoxmlSaveOptions options = new Aspose.Cells.OoxmlSaveOptions();
options.UpdateSmartArt = true;
wb.Save(outputDir + "outputSmartArt.xlsx", options);