anthropics / anthropics/skills

xlsx skill: presentation gotchas — merge banner cells (fill doesn't overflow) and escape & in headers/footers

Offen Anfängerfreundlich
#1,440 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
176k
Forks
20.9k
Ø Merge
7 Std. 21 Min.
Gemergte PRs (30 T.)
5

Beschreibung

## Summary

The `xlsx` skill (`skills/xlsx/SKILL.md`) gives solid guidance on data and formula correctness (recalc, zero-error checks, conventions), but it doesn't mention a couple of openpyxl **presentation** gotchas that silently produce visually broken output. Both are within the skill's existing scope (authoring xlsx with openpyxl). Reporting them with a minimal repro and fix. (This is separate from #584, which covers formula/OOXML compatibility.)

## Gap 1 — a filled title/banner cell does not overflow, so titles get clipped

A very common layout is a title in `A1` with a background fill, where the text is wider than column A and relies on overflow into the empty neighbor cells. Two issues:

- The **fill** only covers `A1`, so the colored banner does not span the width of the table below it.
- The overflow **text** is not shown reliably — it gets clipped at the cell boundary in many renderers, and it's worst when the first column is narrow (e.g. a numbering / `#` column only a few characters wide, which clips the title down to a few letters).

This is easy to miss because some viewers (e.g. Google Sheets) render the overflow on screen so it looks fine, while other renderers/exports clip it at the cell boundary.

**Fix** — merge the banner across the table width so both the fill and the text span correctly:

```python
from openpyxl.utils import get_column_letter
last = get_column_letter(ws.max_column)
ws.merge_cells(f"A1:{last}1") # title banner
ws.merge_cells(f"A2:{last}2") # subtitle, if any
```

A one-line note in the formatting section — "for a title/banner that spans multiple columns, merge the cells; a fill and long text do not overflow reliably" — would prevent this.

## Gap 2 — `&` in headers/footers is a field-code escape character

`&` starts a field code in Excel header/footer strings (`&C` = center section, `&L` / `&R` = left / right section, `&P` = page number, `&D` = date, etc.). A literal `&` in footer/header text is therefore misinterpreted:

```python
ws.oddFooter.left.text = "Revenue & Costs" # "&C" is read as the center-section code
```

renders as `Revenue ` on the left, with everything after `&C` pushed into the center section. A literal ampersand must be doubled:

```python
ws.oddFooter.left.text = "Revenue && Costs" # renders "Revenue & Costs"
```

Worth a one-line note wherever header/footer text is shown.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Open skills/xlsx/SKILL.md and find the formatting and header/footer guidance. Add a note explaining that title banners should merge across the table width because fills and long text do not overflow reliably, and that literal ampersands in header/footer text must be escaped by doubling them. Done means both openpyxl presentation gotchas and their fixes are documented in the existing skill scope.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
85/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.