Presentation Localization
Contents
[
Hide
]
Change Language for Presentation and Shape’s Text
- Create an instance of Presentation class.
- Obtain the reference of a slide by using its Index.
- Add an IAutoShape of Rectangle type to the slide.
- Add some text to the TextFrame.
- Setting Language Id to text.
- Write the presentation as a PPTX file.
The implementation of the above steps is demonstrated below in an example.
$pres = new Presentation("test.pptx");
try {
$shape = $pres->getSlides()->get_Item(0)->getShapes()->addAutoShape(ShapeType::Rectangle, 50, 50, 200, 50);
$shape->addTextFrame("Text to apply spellcheck language");
$shape->getTextFrame()->getParagraphs()->get_Item(0)->getPortions()->get_Item(0)->getPortionFormat()->setLanguageId("en-EN");
$pres->save("output.pptx", SaveFormat::Pptx);
} finally {
if (!java_is_null($pres)) {
$pres->dispose();
}
}