PPTX chart conversion drops parent category labels
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
Research direction
Start in the PptxConverter code where leaf categories are iterated, then inspect python-pptx's Categories.flattened_labels and the existing in-memory PPTX tests. Reproduce the two-level and three-level cases from the issue, preserve the parent-to-child labels in the Markdown table, and verify that each row's values remain unchanged.
Written by the indexing model from the issue text.
Description
PowerPoint charts with hierarchical category axes lose every parent label during conversion. A chart grouped by year and quarter becomes a table with repeated Q1 rows, making it impossible to tell which year's values each row describes.
Reproducer on main (eb31b5c), with markitdown[pptx] installed:
import io
from pptx import Presentation
from pptx.chart.data import CategoryChartData
from pptx.enum.chart import XL_CHART_TYPE
from pptx.util import Inches
from markitdown import MarkItDown
prs = Presentation()
slide = prs.slides.add_slide(prs.slide_layouts[6])
data = CategoryChartData()
for year in ("2024", "2025"):
data.add_category(year).add_sub_category("Q1")
data.add_series("Sales", (10, 20))
slide.shapes.add_chart(
XL_CHART_TYPE.COLUMN_CLUSTERED,
Inches(1), Inches(1), Inches(8), Inches(5), data,
)
stream = io.BytesIO()
prs.save(stream)
stream.seek(0)
print(MarkItDown().convert_stream(stream, file_extension=".pptx").markdown)
Actual table:
| Category | Sales |
|---|---|
| Q1 | 10.0 |
| Q1 | 20.0 |
Expected: retain both 2024 / Q1 and 2025 / Q1 (or otherwise include the parent labels), with each row's values unchanged.
PptxConverter iterates the leaf categories. python-pptx exposes the complete parent-to-child paths through Categories.flattened_labels. This also reproduces with three category levels. I have a focused fix and in-memory PPTX regression tests ready.
- Dominant language
- Python
- Stars
- 186k
- Forks
- 13.7k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 49
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/markitdown
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
microsoft/markitdown#2530 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
microsoft/markitdown#2481 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
microsoft/markitdown#2470 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
microsoft/markitdown#2438 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
microsoft/markitdown#2398 ·
All issues in microsoft/markitdown
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100