Charts: axis c:spPr is appended out of OOXML schema order

Aperta Adatta ai principianti
#648 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
86/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Inizia in sdpm/sdpm/engine/builder/elements/chart.py, nel blocco “Axis lines” di _add_chart, e verifica gli altri inserimenti di c:spPr rispetto all’ordine previsto dallo schema degli assi. Crea grafici a barre e grafici a linee, poi verifica che c:spPr preceda c:txPr e c:crossAx in c:valAx e c:catAx; esegui ruff e pytest sdpm/tests/test_chart_roundtrip.py e aggiungi una voce Fixed sotto [Unreleased] in CHANGELOG.md.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug good first issue

Summary

When the chart builder styles the axis line, it adds the axis c:spPr with etree.SubElement(ax_el, qn('c:spPr')). That appends it as the last child of c:valAx / c:catAx. In the OOXML schema (CT_ValAx / CT_CatAx), c:spPr belongs after c:tickLblPos and before c:txPr / c:crossAx. So the generated chart XML is out of schema order.

Where

sdpm/sdpm/engine/builder/elements/chart.py, the "Axis lines" block in _add_chart (two places: the themed default and the valueAxis.line == "none" branch). The same pattern may apply to other SubElement(..., 'c:spPr') calls in that function; worth checking each against the schema.

Why it matters

As far as I know, PowerPoint accepts this today, so it is a latent problem rather than a visible one. I have not tested every Office version. Strict consumers and validators can reject it, and it will bite when a new chart type (see #620, #621, #622) reuses this code.

Expected

Insert c:spPr at its schema position instead of appending. For example, insert it before the first existing c:txPr, c:crossAx or c:crosses child, or immediately after c:tickLblPos when present.

Done when

  • A helper (for example _insert_in_order) puts c:spPr in the right place for c:valAx and c:catAx.
  • A test builds a bar and a line chart (the types that have axes) and checks that, in c:valAx and c:catAx, c:spPr comes before c:txPr and c:crossAx.
  • CHANGELOG.md [Unreleased] has a Fixed entry.
  • ruff and pytest sdpm/tests/test_chart_roundtrip.py pass.

This is a good first issue: one file, one helper, one test.

🤖 Created by Kiro Crew

Lingua principale
Python
Stelle
136
Fork
13
Merge medio
7h 43m
PR unite (30g)
180

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws-samples/sample-spec-driven-presentation-maker

Tutte le issue di aws-samples/sample-spec-driven-presentation-maker

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.