main
HuangHai 4 weeks ago
parent 35d113b86f
commit 324573ea31

@ -1,11 +1,8 @@
import os
from Util.WordImageUtil import extract_images_from_docx
# 使用示例
if __name__ == "__main__":
word_path = "d:\\dsWork\\dsProject\\dsRag\\Test\\带图的WORD文档.docx"
word_path = "d:\\dsWork\\dsProject\\dsRag\\static\\Test\\带图的WORD文档_MATH_3.docx"
output_dir = "../static/Images" # 图片输出目录
os.makedirs(output_dir, exist_ok=True)
extract_images_from_docx(word_path, output_dir)

@ -1,5 +1,3 @@
import os
import docx
@ -32,10 +30,5 @@ def read_word_content(docx_path):
if __name__ == "__main__":
# 示例用法
# 请将 'your_document.docx' 替换为你的Word文档路径
word_document_path = "d:\\dsWork\\dsProject\\dsRag\\static\\Test\\带图的WORD文档_MATH_3.docx"
if os.path.exists(word_document_path):
read_word_content(word_document_path)
else:
print(f"文件不存在: {word_document_path}")
read_word_content(word_document_path)

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Loading…
Cancel
Save