I’m trying to replace text in shapes. It works fine, but I’m having problems if the shape is a rectangle. Then the TextFrame.Text property is empty and I cannot see texts in the Paragraphs as well.
How can I access the text of a rectangle shape properly?
My current code:
var textHolders = shapes.Where(i => i.GetType() == typeof(AutoShape)) as IEnumerable<IShape>;
if (textHolders != null)
{
foreach (AutoShape shape in textHolders)
{
if (shape.TextFrame.Text.Contains("<$version$>"))
{
shape.TextFrame.Text = shape.TextFrame.Text.Replace("<$version$>", "V0.1");
}
if (shape.TextFrame.Text.Contains("<$copyright$>"))
{
shape.TextFrame.Text = shape.TextFrame.Text.Replace("<$copyright$>", "2018");
}
}
}