Free Support Forum - aspose.com

Aspose.Cells for .NET: Replacement of the texts in SmartArt doesn't work

Aspose.Cells for .NET 18.7

SmartArt.zip (28.2 KB)

5 Rectangles in SmartArt_out.xlsx are expected to have “ReplacedText” with the code below but they don’t.
Do you have any ideas?

Workbook book = new Workbook("SmartArt.xlsx");
foreach (Worksheet worksheet in book.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.
            }
        }
    }
}
book.Save("SmartArt_out.xlsx");

@KDSSHO

We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46261 - Replacement of the texts in SmartArt does not work

Thanks please keep me posted.

@KDSSHO

We have further investigated the ticket and have found that, all shapes returned by shape.GetResultOfSmartArt() are read only. Updating any setting of these shapes is not supported.

OK.

So does “not supported” mean that Aspose.Cells does not have any solution to set the value for an existing SmartArt objects?
If so, please take this ticket into consideration as one of the feature requests.

@KDSSHO,

We are discussing this issue at our end and will inform you once any feedback is ready to share.

@KDSSHO,

We have considered this ticket as a feature request but this can take some time to resolve. Once there is any information to be shared, we will let you know.

I’d love to hear the news as soon as possible. thanks.

@KDSSHO,

You are welcome.

@KDSSHO,

This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

Hi Amjad,

Thank you. I’ll check it and be back if need arises.

The issues you have found earlier (filed as CELLSNET-46261) have been fixed in Aspose.Cells for .NET v18.11. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi

@KDSSHO,

You may use following sample code to save the updated text in smartart. Notice the use of OoxmlSaveOptions.UpdateSmartArt flag which is set to true.

Workbook wb = new Workbook("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("SmartArt_out.xlsx",options);