Skip to content

mac can not open saved content #274

@zhaozhi406

Description

@zhaozhi406

I tried the example code which is on the documentation page, but I can not open the saved pptx file, what I mean is that I double clicked the saved file in finder, nothing displayed and no exception jumped out.

So I tried another way, first I saved an empty pptx file use the microsoft powerpoint app, second I read the file in my code, and then I added some text, and save. Then in the finder, I can open the saved file and see the content which I added in the code. Why?

Below is my code:

       $reader = IOFactory::createReader("PowerPoint2007");

       $objppt = $reader->load("empty.pptx");

       $shape = $objppt->getActiveSlide()->createRichTextShape()
            ->setHeight(300)
            ->setWidth(600)
            ->setOffsetX(170)
            ->setOffsetY(180);

        $shape->getActiveParagraph()->getAlignment()->setHorizontal( Alignment::HORIZONTAL_CENTER );
        $textRun = $shape->createTextRun('Thank you for using PHPPresentation!');
        $textRun->getFont()->setBold(true)
            ->setSize(60)
            ->setColor( new Color( 'FFE06B20' ) );

        $w = IOFactory::createWriter($objppt, 'PowerPoint2007');
        $w->save(__DIR__ . "/from-empty.pptx");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions