Skip to content

Adopt upstream PR #2851: Fix boolean read val error for strike tags #18

@protobi-pieter

Description

@protobi-pieter

Summary

Adopt upstream PR exceljs#2851 to fix parsing of boolean XML attributes with explicit val="0".

Currently, the code doesn't handle <strike val="0"/> correctly - it always sets the model to true. This fix properly checks the val attribute and sets model to false when val="0".

Upstream PR

Changes

File modified:

  • lib/xlsx/xform/simple/boolean-xform.js - Fix parseOpen to check val attribute (1 line)

Total: 1 addition, 1 deletion

Bug Description

When reading Excel files with strike-through formatting that is explicitly disabled (<strike val="0"/>), the parser incorrectly interprets it as strike-through enabled.

Current behavior:

parseOpen(node) {
  if (node.name === this.tag) {
    this.model = true;  // Always true!
  }
}

Fixed behavior:

parseOpen(node) {
  if (node.name === this.tag) {
    this.model = node.attributes.val !== "0";  // Respects val attribute
  }
}

Value Proposition

  • Low Risk - Single line change in boolean parsing
  • Bug Fix - Corrects incorrect parsing behavior
  • Standards Compliant - Properly handles OOXML boolean attributes

Testing Plan

  • Apply changes from upstream PR
  • Run existing test suite
  • Verify boolean attributes parse correctly

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