iOfficeAI / iOfficeAI/OfficeCLI

validate: false positive "unexpected child element color" on xlsx styles.xml font (openpyxl/OfficeCLI output rejected, Excel-native order passes)

Open
#295 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
30.7k
Forks
2.1k
Avg merge
9d 8h
Merged PRs (30d)
5

Description

## Summary

`officecli validate` reports a schema error on xlsx files whose first `` element lists `color` after `family` (the order emitted by openpyxl, and preserved by OfficeCLI's own save path). The same file opened, read, and recalculated by Excel without complaint; an Excel-native file and a manually reordered copy pass validation.

## Repro

Create `repro.xlsx` with openpyxl (a font with name/family/color/sz/scheme, e.g. any workbook with a styled header), then:

```
officecli validate repro.xlsx
```

Output:

```
Found 1 validation error(s):
[Schema] The element has unexpected child element 'http://schemas.openxmlformats.org/spreadsheetml/2006/main:color'.
Path: /x:styleSheet[1]/x:fonts[1]/x:font[1]
Part: /xl/styles.xml
```

The offending font element (identical in the openpyxl original and after an OfficeCLI `set` edit):

```xml

```

## Isolation

- Excel-native xlsx (saved via Excel) validates clean; its font element is ``.
- Reordering the openpyxl font to the Excel-native order (`sz, color, name, family, scheme`) makes `validate` pass.
- The error also fires on the ORIGINAL openpyxl file before any OfficeCLI write, so it is not introduced by the edit path — it is a validator schema strictness issue for the `CT_Font` child sequence.

## Expectation

Validation should accept font child orders produced by common producers (openpyxl, Excel) — either order-insensitive checking or a sequence matching what Excel itself emits.

## Environment

- OfficeCLI v1.0.143 (win-x64), SHA256 verified
- Excel 2016+/Microsoft 365 (COM automation)
- openpyxl-generated corpus

Full comparison evidence: this was found during a 4-boundary evaluation (round-trip / formulas / rendering / concurrency) at https://github.com/iOfficeAI/OfficeCLI — happy to share the corpus files if useful.

Contributor guide

Open the contributing guide

Research direction

Start at the `officecli validate repro.xlsx` path and trace the schema validation for `/xl/styles.xml`, especially the `CT_Font` child sequence. Use the supplied openpyxl-generated font and reordered copy as fixtures; done means validation accepts both common child orders without reporting the unexpected `color` element.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.