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

オープン 初心者向け
#648 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
86/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

sdpm/sdpm/engine/builder/elements/chart.py の _add_chart にある「Axis lines」ブロックから始め、ほかの c:spPr の挿入箇所を軸スキーマの順序と照らして確認してください。棒グラフと折れ線グラフを作成し、c:valAx と c:catAx で c:spPr が c:txPr および c:crossAx より前にあることを確認してください。ruff と pytest sdpm/tests/test_chart_roundtrip.py を実行し、CHANGELOG.md の [Unreleased] の下に Fixed の項目を追加してください。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Python
スター
136
フォーク
13
平均マージ
7時間 43分
マージ済み PR(30日)
180

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aws-samples/sample-spec-driven-presentation-maker のほかの issue

aws-samples/sample-spec-driven-presentation-maker の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。