Hi Team,
I have tried to re-produce same issue by creating sample console application but not able to replicate it into sample application. Here is code for same. I have also attached source presentation. Please suggest.
PresentationTemplate.zip (582.2 KB)
class Program
{
static void Main(string[] args)
{
try
{
Presentation MasterTemplate;
Presentation Pres;
ISlideCollection slds;
ISlide PrioritySlide;
string appDirectory = Environment.CurrentDirectory;
MasterTemplate = new Presentation(appDirectory + "/PresentationTemplate/ServiceOverviewReport_Template.pptx");
Pres = new Presentation(appDirectory + "/PresentationTemplate/ServiceOverviewReport_Layout.pptx");
slds = Pres.Slides;
string PriorityName = "DGP tuehesm ahagghgh and qsqcucnmh";
//string TermNotes = "helps Account-asdfg marketers asdfedc the proper ayyroach and access the axwswwory ppppa and aspaxilitgts to deliver concrete, specific AAA aaaaaaa plans that target the right audience with the right message to drive desired results. Our approach is shaped by best practices and a deep reservoir of experience with ABC olagging and ecevtgtiod that enables our clients to have confidence in their jhsjhggdh thans.";
string TermNotes = "Industry ABM account tactic review and selection\nIndustry ABM collaborating with sales\nIndustry ABM contact insights\nIndustry ABM for channel\nIndustry ABM grouped account-to-marketer ratio\nIndustry ABM measurement, refinement and expansion\nIndustry ABM pipeline acceleration\nIndustry ABM measurement, refinement and expansion\nIndustry ABM pipeline acceleration";
Aspose.Slides.License slideLicense = new Aspose.Slides.License();
slideLicense.SetLicense(appDirectory + "/PresentationTemplate/Aspose.Total.lic");
slds.InsertClone(0, MasterTemplate.Slides[0]);
PrioritySlide = Pres.Slides[0];
IShape shape;
shape = FindShape(PrioritySlide, "Description4");
if (shape != null)
{
string str = ((IAutoShape)shape).TextFrame.Text;
if (((IAutoShape)shape).TextFrame.Text != "")
{
if (!string.IsNullOrEmpty(TermNotes))
{
str = str.Replace("<Description_4>", WebUtility.HtmlDecode(Regex.Replace(TermNotes, "<.*?>", String.Empty)));
}
else
{
str = str.Replace("<Description_4>", "");
}
}
((IAutoShape)shape).TextFrame.Text = str;
}
shape = FindShape(PrioritySlide, "PriorityTerm4");
if (shape != null)
{
string str = ((IAutoShape)shape).TextFrame.Text;
if (((IAutoShape)shape).TextFrame.Text != "")
{
if (!string.IsNullOrEmpty(PriorityName))
{
str = str.Replace("<Priority_Term_4>", PriorityName);
}
else
{
str = str.Replace("<Priority_Term_4>", "");
}
}
((IAutoShape)shape).TextFrame.Text = str;
}
string ReportName = "Demo_Overview_Report.pptx";
Pres.Save(appDirectory + "/PresentationDownloads/" + ReportName, Aspose.Slides.Export.SaveFormat.Pptx);
}
catch (Exception ex)
{
}
}
public static IShape FindShape(ISlide slide, String Name, List<string> shapeindex = null)
{
IShape selectedShape = null;
for (int i = 0; i < slide.Shapes.Count; i++)
{
if (shapeindex != null)
{
if (shapeindex.Any(s => slide.Shapes[i].Name.Contains(s)))
{
slide.Shapes[i].Hidden = false;
}
else if (slide.Shapes[i].Name != "Group 50" && slide.Shapes[i].Name != "Title" && slide.Shapes[i].Name != "Rectangle 44"
&& slide.Shapes[i].Name != "TextBox 45" && slide.Shapes[i].Name != "Picture 52" && slide.Shapes[i].Name != "Picture 56" && slide.Shapes[i].Name != "Title 2")
{
slide.Shapes[i].Hidden = true;
}
}
if (slide.Shapes[i].Name.CompareTo(Name) == 0)
{
if (shapeindex == null)
{ return slide.Shapes[i]; }
else
{ selectedShape = slide.Shapes[i]; }
}
}
if (selectedShape != null)
{
return selectedShape;
}
return null;
}
}