Skip to content

It started giving an error when opening PPTX generated after the update. #858

Open
@omarjavierr277

Description

@omarjavierr277

I was reviewing the issue, and it seems that the error occurs when updating phpoffice/common from version 1.0.4 to 1.0.5.

This happens even when running the examples provided by the library, even with a blank slide.

Error message from PowerPoint:

PowerPoint found a problem with the content in example.pptx.
PowerPoint can attempt to repair the presentation.
If you trust the source of this presentation, click Repair.

Example Code:

$ppt = new PhpPresentation();
$slide = $ppt->getActiveSlide();

    // Establecer color de fondo
    $backgroundColor = new Color();
    $backgroundColor->setColor(new StyleColor(StyleColor::COLOR_BLUE));
    $slide->setBackground($backgroundColor);

    // Guardar archivo en almacenamiento local
    $fileName = 'test1.pptx';
    $savePath = storage_path("app/{$fileName}");

    $writer = IOFactory::createWriter($ppt, 'PowerPoint2007');
    $writer->save($savePath);

    // Confirmar que se guardó correctamente
    if (Storage::exists($fileName)) {
        $this->info('Presentación guardada en: ' . $savePath);
    } else {
        $this->error('Error al guardar el archivo.');
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions