Skip to content

ODPresentation : A text box writes neither its insets, nor its wrap, nor its vertical alignment #975

Description

@dkulyk

Description

Six properties of a text box never reach the file, and none of them is read back.

  • getInsetLeft(), getInsetRight(), getInsetTop() and getInsetBottom() have no counterpart written. OpenDocument states them as the padding of the frame, fo:padding-left and the three beside it.
  • getWrap() is not written either. fo:wrap-option is written as the literal wrap whatever the shape says, so a shape told not to wrap its text still wraps.
  • getVerticalAlignCenter() is not written. draw:textarea-vertical-align is the attribute for it.

The PowerPoint2007 Writer writes all six.

Steps to reproduce

$shape = $presentation->getActiveSlide()->createRichTextShape();
$shape->createTextRun('Sample');
$shape->setWrap(RichText::WRAP_NONE);
$shape->setVerticalAlignCenter(RichText::VALIGN_CENTER);
$shape->setInsetBottom(3)->setInsetLeft(12)->setInsetRight(24)->setInsetTop(6);

Expected behavior

The text sits 12 pixels from the left of its box and is centred between its top and bottom, and does not wrap; reading the file back gives the six values that were set.

Actual behavior

content.xml carries no fo:padding-* and no draw:textarea-vertical-align, and fo:wrap-option="wrap". Read back, the shape returns the defaults it was born with: insets 9.6, 9.6, 4.8, 4.8, WRAP_SQUARE, VALIGN_NOTCENTER.

Notes

Found while walking every property of a shape through each Writer/Reader pair and diffing what came back.

getName() is missing from the same frame and is not part of this: loadShapeDescription() falls back to draw:name for files written by older versions, so writing a text box's name there would come back as its description. That one needs deciding separately.

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