Skip to content

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

feat: update DOCX processing to change test document path and enhance chart handling with improved content structure

myhloli8381e61f0cea
diff --git a/mineru/backend/office/docx_analyze.py b/mineru/backend/office/docx_analyze.py
index 78152445..c58fb1f1 100644
--- a/mineru/backend/office/docx_analyze.py
+++ b/mineru/backend/office/docx_analyze.py
@@ -29,7 +29,7 @@ def office_docx_analyze(
return middle_json, results
if __name__ == '__main__':
- docx_path = "/Users/myhloli/projects/20240809magic_pdf/Magic-PDF/mineru/model/docx/test.docx"
+ docx_path = "/Users/myhloli/projects/20240809magic_pdf/Magic-PDF/mineru/model/docx/drawingml.docx"
from mineru.data.data_reader_writer import FileBasedDataWriter
with open(docx_path, 'rb') as f:
file_bytes = f.read()
diff --git a/mineru/model/docx/docx_converter.py b/mineru/model/docx/docx_converter.py
index 01eedc3a..8debac21 100644
--- a/mineru/model/docx/docx_converter.py
+++ b/mineru/model/docx/docx_converter.py
@@ -1294,12 +1294,8 @@ class DocxConverter:
if chart is not None:
# 如果找到 chart 元素,构造空的表格块,后续回填html
table_block = {
- "image_source": "",
- "html": "",
- "table_caption": "",
- "table_footnote": "",
- "table_type": "",
- "table_nest_level": "",
+ "type": BlockType.TABLE,
+ "content": "",
}
self.cur_page.append(table_block)
self.chart_list.append(table_block)
@@ -1339,4 +1335,4 @@ class DocxConverter:
content = zf.read(name)
excel_data = pd.read_excel(BytesIO(content))
html = excel_data.to_html(index=False, header=True)
- self.chart_list[chart_idx - 1]["html"] = html
+ self.chart_list[chart_idx - 1]["content"] = html
diff --git a/pyproject.toml b/pyproject.toml
index 5423abfd..4bbda444 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -45,6 +45,8 @@ dependencies = [
"mammoth>=1.11.0,<2",
"pylatexenc>=2.10,<3",
"lxml>=4.0.0,<7.0.0",
+ "pandas>=2.3.3,<3",
+ "openpyxl>=3.1.5,<4",
]
[project.optional-dependencies]