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

未关闭 适合新手
#648 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
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 分钟
30 天内合并 PR
180

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

aws-samples/sample-spec-driven-presentation-maker 的其他 Issue

查看 aws-samples/sample-spec-driven-presentation-maker 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。