You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
561 B
18 lines
561 B
import os
|
|
|
|
from Util.WordImageUtil import extract_images_from_docx
|
|
|
|
|
|
# 使用示例
|
|
if __name__ == "__main__":
|
|
word_path = "d:\\dsWork\\dsProject\\dsRag\\Test\\带图的WORD文档.docx"
|
|
output_dir = "../static/Images" # 图片输出目录
|
|
os.makedirs(output_dir, exist_ok=True)
|
|
images = extract_images_from_docx(word_path, output_dir)
|
|
|
|
# 打印结果
|
|
for img in images:
|
|
print(f"图片保存至: {img['image_path']}")
|
|
loc = img['location']
|
|
print(f"位置信息: 段落 {loc['paragraph_index']}")
|