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

Đang mở Phù hợp với người mới
#648 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
86/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu trong sdpm/sdpm/engine/builder/elements/chart.py, ở khối “Axis lines” của _add_chart, và đối chiếu các vị trí chèn c:spPr khác với thứ tự trong lược đồ trục. Tạo biểu đồ cột và biểu đồ đường, sau đó xác minh rằng c:spPr đứng trước c:txPr và c:crossAx trong c:valAx và c:catAx; chạy ruff và pytest sdpm/tests/test_chart_roundtrip.py, rồi thêm một mục Fixed bên dưới [Unreleased] trong CHANGELOG.md.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
136
Fork
13
Merge trung bình
7 giờ 43 phút
Pull request đã merge (30 ngày)
180

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của aws-samples/sample-spec-driven-presentation-maker

Tất cả issue của aws-samples/sample-spec-driven-presentation-maker

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.