I have a pptx file with the following text on the first slide:
[this is a test]
I want to use Aspose.Slides to find this string and replace it with something else. I am using code similar to the search/replace code provided by Aspose:
pres = new Presentation(_dto.Document_Template_Path);
ITextFrame[] tb = SlideUtil.GetAllTextFrames(pres, true);
for (int i = 0; i < tb.Length; i++)
{
foreach (Aspose.Slides.Paragraph para in tb[i].Paragraphs)
{
foreach (Portion port in para.Portions)
{
if (port.Text == "[this is test]")
{
// do my replacement here
}
}
}
}
Unfortunately there seems to be an issue with how Portions are parsed. When I step through the code, I see that my string in PowerPoint is respresented as
Aspose.Slides.Portion[0] [this is a test
Aspose.Slides.Portion[1] ]
As you can see, the Aspose parser is incorrectly splitting the text in PowerPoint into two different portions.
This makes search and replace not possible.
Is this a known issue, or is there a different way to do search/replace using Aspose Slides?
Thanks