Skip to content

PowerPoint2007 Writer : A comment inside a group is related but never written #990

Description

@dkulyk

Description

A Comment that sits inside a Group is written as a relationship to a part that is never written.

Writer\PowerPoint2007\PptSlides walks a slide with flattenShapes(), so it finds the comment and
writes ppt/slides/_rels/slideN.xml.rels with a relationship of type .../comments pointing at
../comments/commentN.xml. The four writers that were to answer for that relationship walk
getShapeCollection() flat instead and never see the comment:

writer what it did not do
PptComments write ppt/comments/commentN.xml
ContentTypes declare the Override for that part
CommentAuthors write ppt/commentAuthors.xml
Relationships relate the author list from the presentation

So the package goes out holding a relationship whose target is not in it.

Steps to reproduce

$presentation = new PhpPresentation();
$group = new Group();
$group->addShape(new Comment());
$presentation->getActiveSlide()->addShape($group);

(new PowerPoint2007($presentation))->save('group-comment.pptx');

Expected behavior

ppt/comments/comment1.xml is in the package, its content type is declared, and the author list is
written and related.

Current behavior

ppt/slides/_rels/slide1.xml.rels names ../comments/comment1.xml, and no such part exists.
PowerPoint asks to repair the file on open.

The same comment placed directly on the slide is written correctly, so only a comment inside a group
is affected. A group can hold a group, so the nesting is not one deep.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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