We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Why textholder looses its style when its text changed dynamicaly

I have a textholder in a slide and some styles are applied to the text. I want to change the text in textholder dynamicaly using aspose and also want to preserve its text styles(font,embose,shadow etc).
i used the following code to change the text dynamicaly and it change value of the text property

foreach (Shape s in slide.Shapes)
if (s.IsTextHolder)
TextHolder h = (TextHolder)s.Placeholder;
h.Text = “New Titile”;

I can change the using the above code but i causes the text styles(font,embose,shadow etc) to lose. Any solution to this

thanks & regards


Dear Nitheesh,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

When you set the text via TextFrame.Text or TextHolder.Text property, you destroy the Portions inside it which actually holds the formatting.

So change your code like this

h.Paragraphs[0].Portions[0].Text=”New Title”;