Skip to content

xlsx: a comment's VML shape style has a value with no property name (margin-left / margin-top missing) #532

Description

@t-ujiie-g

moonbitlang/mbtexcel@0.1.10, xlsx/write_comments_vml.mbt:95.

What happens

The <v:shape> written for a comment carries a style attribute in which one value has no property name:

style="position:absolute;73.5pt;width:108pt;height:59.25pt;z-index:1;visibility:hidden"
                        ^^^^^^^ no property name

73.5pt is not a declaration, so the whole thing is malformed CSS. Excel itself writes both offsets:

style='position:absolute;margin-left:842pt;margin-top:69pt;width:169pt;height:226pt;z-index:1;visibility:hidden;mso-wrap-style:tight'

so margin-left: and margin-top: appear to have been dropped from the literal.

The same file gets it right for header/footer images at line 873:

let style = "position:absolute;margin-left:0;margin-top:0;width:\{image.width};height:\{image.height};z-index:1"

which suggests this is a slip in the comment path alone.

Reproduction

Any workbook with one comment; look at xl/drawings/vmlDrawing1.vml.

Severity

Low in practice: Excel positions a note from <x:Anchor>, not from the VML style, and Excel for Mac 16.x shows the note correctly and offers no repair. But the declaration is invalid as written, so a stricter consumer may reject it.

A neighbouring observation

Every comment shape also gets the same fixed geometry — 73.5pt, width:108pt, height:59.25pt, z-index:1 — with only <x:Anchor> varying per cell. Since Anchor is what Excel reads there is no visible damage, but deriving margin-left / margin-top (and a distinct z-index) from the anchor would make the two agree.

Found downstream in t-ujiie-g/yxl#82.

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