-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwordRead.py
More file actions
28 lines (25 loc) · 757 Bytes
/
wordRead.py
File metadata and controls
28 lines (25 loc) · 757 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from docx import Document
from docx.enum.shape import WD_INLINE_SHAPE
from docx.shape import InlineShape
import os
import olefile
print("bins")
data = ['test.png','test1.png']
i = 0
ole = olefile.OleFileIO("testing.docx")
# doc = docx.Document("testingDemo.docx")
doc = Document("testing.docx")
# imgType = "WD_INLINE_SHAPE.LINKED_PICTURE"
# for oleEmbed in doc.inline_shapes :
# blip = doc.inline_shapes[i]._inline.graphic.graphicData.pic.blipFill.blip
# rID = blip.embed
# rID = blip.embed
# document_part = doc.part
# image_part = document_part.related_parts[rID]
# fr = open(data[i], "wb")
# fr.write(image_part._blob)
# i += 1
# doc.add_picture(R"AutomationProject\gitConfigList.png")
# doc.save("testing.docx")
# fr.close()
print("ends")