Browse our Products

Aspose.Slides for PHP via Java 23.2 Release Notes

KeySummaryCategory
SLIDESPHP-21Use Aspose.Slides for Java 23.2 featuresEnhancement

Public API Changes

Find and replace text fragments with changes in formatting

Added support for finding and replacing text fragments with changes in formatting. A new method in the public API has been added for this purpose: SlideUtil.findAndReplaceText.

The example below searches for all portions of “[this block] " and replaces them with “my text” filled in red:

$pres = new Presentation("pres.pptx");
$format = new PortionFormat();
$format->setFontHeight(24);
$format->setFontItalic(NullableBool::True);
$format->getFillFormat()->setFillType(FillType::Solid);
$color = new Java("java.awt.Color");
$format->getFillFormat()->getSolidFillColor()->setColor($color->RED);

SlideUtil::findAndReplaceText($pres, true, "[this block]", "my text", $format);
$pres->save("replaced.pptx", SaveFormat::Pptx);