链接: [https://pypi.org/project/vsdx/]
安装vsdx
pip install vsdx
打开vsdx
from vsdx import VisioFile # import the package
from vsdx import Connect
from vsdx import Page
from vsdx import Shape
from vsdx import VisioFile
from vsdx import Cell
with VisioFile('diagram.vsdx') as vis:
# open first page
page = vis.pages[0] # type: VisioFile.Page
# find a shape by text
shape = page.find_shape_by_text('foo') # type: VisioFile.Shape
if shape == None:
print("shape not found")
# copy shape
lx, ly = 1, 1
cp1 = shape.copy(page)
cp1.text = "foo1"
cp1.x, cp1.y = lx, ly
# save to a new file
vis.save_vsdx("copy of diagram.vsdx")