main
黄海 9 months ago
parent a8d60689bc
commit ff53532c56

@ -1,4 +1,5 @@
# pip install pywin32
# https://blog.csdn.net/weixin_42927998/article/details/115086797
import win32com
from win32com.client import Dispatch

@ -0,0 +1,18 @@
# pip install pywin32
# https://blog.csdn.net/weixin_42927998/article/details/115086797
import win32com
from win32com.client import Dispatch
docApp = win32com.client.Dispatch('Word.Application')
docApp.Visible = True
docApp.DisplayAlerts = 0
doc = docApp.Documents.Open('c:/1.docx')
# 遍历文档中的所有内嵌形状
for inline_shape in doc.InlineShapes:
if inline_shape.Type == win32com.client.constants.wdInlineShapeChart: # 检查是否为内嵌图表
print("找到一个图表")
# 这里可以对图表进行操作,比如获取图表的类型、数据等
doc.Close()
docApp.Quit()
Loading…
Cancel
Save