Skip to content

Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.

feat: improve chart extraction by adding fallback to HTML table rendering from Excel bytes

myhloli52ef2a215f45
diff --git a/mineru/backend/utils/office_chart.py b/mineru/backend/utils/office_chart.py
index 28d593e3..fc09447b 100644
--- a/mineru/backend/utils/office_chart.py
+++ b/mineru/backend/utils/office_chart.py
@@ -102,6 +102,9 @@ def extract_chart_html_from_ooxml(chart_xml: bytes, workbook_bytes: bytes | None
chart_html = render_chart_html_from_workbook(spec, workbook_bytes)
if chart_html:
return chart_html
+ workbook_table_html = html_table_from_excel_bytes(workbook_bytes)
+ if workbook_table_html:
+ return workbook_table_html
return render_chart_html_from_cache(spec)
diff --git a/mineru/model/docx/docx_converter.py b/mineru/model/docx/docx_converter.py
index 427c8771..cfaa5807 100644
--- a/mineru/model/docx/docx_converter.py
+++ b/mineru/model/docx/docx_converter.py
@@ -2563,6 +2563,12 @@ class DocxConverter:
if chart is None:
continue
+ chart_block = {
+ "type": BlockType.CHART,
+ "content": "",
+ }
+ self.cur_page.append(chart_block)
+
rel_id = chart.get(rel_id_attr)
if not rel_id:
continue
@@ -2592,15 +2598,8 @@ class DocxConverter:
logger.warning(f"Warning: chart workbook cannot be loaded: {e}")
chart_html = extract_chart_html_from_ooxml(chart_xml, workbook_bytes)
- if not chart_html:
- continue
-
- self.cur_page.append(
- {
- "type": BlockType.CHART,
- "content": chart_html,
- }
- )
+ if chart_html:
+ chart_block["content"] = chart_html
def _handle_textbox_content(
self,