Skip to content

PowerPoint2007 Reader : a shape's border is never read back #969

Description

@dkulyk

The PowerPoint2007 Writer writes a shape's Border as a:ln in p:spPr, from three places --
writeShapeText() (AbstractSlide.php:270), writeShapeLine() (:872) and writeShapePic()
(:1568), all through writeBorder(). The Reader never reads it back.

loadShapeRichText() and loadShapeDrawing() both open p:spPr and take the fill out of it
(Reader/PowerPoint2007.php:1020 and :1201), and stop there. So a shape loaded from a file always
wears the border it was born with -- LINE_NONE, from AbstractShape.php:145 -- whatever the file
says.

Measured on 63f09988a, a RichText given a black single 1px border, written, loaded and written
again:

<!-- written -->
<a:ln w="9525" cap="flat" cmpd="sng" algn="ctr">
  <a:solidFill><a:srgbClr val="000000"><a:alpha val="100000"/></a:srgbClr></a:solidFill>
  <a:prstDash val="solid"/><a:round/>
  <a:headEnd type="none" w="med" len="med"/><a:tailEnd type="none" w="med" len="med"/>
</a:ln>

<!-- loaded, then written again -->
<!-- nothing -->

The whole element is gone, and with it the width, the compound, the dash and the colour.

This is not a gap in the model or in the parsing code: loadStyleBorder()
(Reader/PowerPoint2007.php:1923) already reads exactly this element -- w through
emuToPixels(), cmpd into the line style, a:noFill into LINE_NONE, a:solidFill/a:srgbClr
into the colour and a:prstDash into the dash. It is only ever called for the six borders of a
table cell (:1330-:1350). Calling it for a shape is the fix, and a PR follows.

Same in the ODPresentation Reader: Border reaches the model only through
$oCell->setBorders() (Reader/ODPresentation.php:1169). That half is not in the PR.

Related but separate: Border cannot describe a gradient or a pattern line, because its colour is
a Color and not a Fill -- #943. A line written with a:gradFill therefore still comes back as
a colour, which is a limitation of the model this issue does not touch.

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