Free Support Forum -

Replace txt in master template


We want to replace footer text with current year in newly generated presentation. we have tag in master layout template. we are using following code to replace the year.
shape = FindShape(Slide, “FooterText1”);
if (shape != null)
string CurrentYear = Convert.ToString(System.DateTime.Now.Year);
((IAutoShape)shape).Hidden = false;
string str = ((IAutoShape)shape).TextFrame.Text;
if (((IAutoShape)shape).TextFrame.Text != “”)
str = !string.IsNullOrEmpty(CurrentYear) ? str.Replace("", CurrentYear) : str.Replace("", “”);
((IAutoShape)shape).TextFrame.Text = str;

but now we have moved the footer test to master layout, after that we are enable to replace text using above code. can you please suggect way to do that??

attached presentation layout with more clarification.aspose year issue.png (14.6 KB)


I have observed the image shared by you and request you to please share the source presentation and desired output presentation. We will investigate the requirements further on our end to help you out.