Skip to content

feat(ooxml): Preserve VML comment styling during round-trips #169

@arcaputo3

Description

@arcaputo3

Background

When modifying a sheet that contains comments, the VML drawing file (xl/drawings/vmlDrawingN.vml) is regenerated from scratch rather than preserved from the source file. This means custom VML styling is lost.

Related: #166 (fix for comments overwrite bug)

What VML Controls

VML (Vector Markup Language) stores visual properties for comment boxes:

  • Position (margin-left, margin-top)
  • Size (width, height)
  • Fill color (custom colors beyond default yellow)
  • Stroke/border settings
  • Shadow settings
  • Visibility state (always visible vs hover-only)
  • z-index ordering
  • Custom anchor offsets

Current Behavior

Scenario VML Behavior
Unmodified sheet ✅ Preserved byte-for-byte
Modified sheet ❌ Regenerated with defaults

When regenerated, comments get fixed defaults:

  • Size: 108pt × 59.25pt
  • Color: infoBackground [80] (yellow)
  • Position: Calculated from cell position
  • Visibility: Hidden (shows on hover)

Proposed Solution

  1. Parse VML on read - Extract comment visual properties into domain model
  2. Extend Comment type - Add optional CommentStyle or VmlProperties field
  3. Preserve on write - Use stored properties when regenerating VML

Complexity

VML is a complex legacy format. This is a non-trivial enhancement that requires:

  • VML parser (currently binary passthrough)
  • Domain model extension
  • Round-trip testing for VML properties

Acceptance Criteria

  • Comments with custom sizes preserve size on round-trip
  • Comments with custom positions preserve position on round-trip
  • Comments with custom colors preserve color on round-trip
  • Comments with "always visible" state preserve visibility
  • Existing tests continue to pass

Priority

Low - This is a fidelity enhancement, not a correctness issue. Comments content and author are preserved correctly; only visual styling is affected.

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