Skip to content

Text missing in PowerPoint, but shows up in Google Slides, LibreOffice Impress #767

@DeveloperMCD

Description

@DeveloperMCD

I have a very simple example, with a lot of code similar to below.
I thought everything was going great -- no errors, everything showing up as intended.
But only in LibreOffice (Impress) or Google Suite (Slides).
When my boss checked it out with actual Microsoft Powerpoint, only the upper-right graphic (logo) appeared, as well as a bunch of empty rectangles (should have text in them).
All the text is invisible/not there. Only in Powerpoint.

How can this be? This is a very basic Powerpoint file, saved in this way:
$oWriterPPTX = IOFactory::createWriter($presentation, 'PowerPoint2007');
$oWriterPPTX->save(DIR . "/ppt/sample.pptx");

Is the PPTX extension the problem? Maybe because it's only a PPT, so Microsoft is interpreting the file horribly wrong (compared to their competitors, who do a fine job)?

I'm using the latest version of PHPPresentation (downloaded a few days ago) and

PHP 8.2.12 (cli) (built: Oct 26 2023 17:33:26) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.12, Copyright (c) Zend Technologies
with Zend OPcache v8.2.12, Copyright (c), by Zend Technologies
with Xdebug v3.2.1, Copyright (c) 2002-2023, by Derick Rethans

Here is the code I'm using:

// Create a shape (text)
$shape = $nextSlide->createRichTextShape()
->setHeight(450)
->setWidth(560)
->setOffsetX(320)
->setOffsetY(175);
$shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER );

$shape->getBorder()
->setLineStyle(Border::LINE_SINGLE)
->setLineWidth(2)
->getColor()->setARGB('FF000000');

$textRun = $shape->createTextRun("Foo bar");
$textRun->getFont()->setBold(true)
->setSize(14)
->setColor( new Color('000000') );

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions