Visio VBA 将动态连接器设置为直连接器样式

问题描述 投票:0回答:1

我在 Windows 10 平台上使用 Python 通过 win32com.Client 控制 Visio。我在这个项目上取得了很大的成功,但我一直在寻找答案。我一直在搜索 Microsoft 文档(当然是 VBA)但找不到答案。

我正在向形状添加连接点,并使用动态连接器将它们连接起来,没有出现任何问题。我删除的所有连接器都显示为直角连接器,我想将其中一些连接器切换为直或弯曲连接器样式。我在 ShapeSheet 中没有找到任何看起来像正确设置的内容。对于我用来删除连接器的代码的价值如下。预先感谢您提供的任何帮助!

# visSectionConnectionPts = 7
shape = self.v_app.draw_page.Drop(self.v_app.app.ConnectorToolDataObject, 5, 4)
shape.Cells("BeginX").GlueTo(s_shp.shape.CellsSRC(7, s_row, 0))
shape.Cells("EndX").GlueTo(d_shp.shape.CellsSRC(7, d_row, 0))

if arrow:
  shape.Cells("EndArrow").FormulaForceU = "13"
if len(text) > 0:
  shape.Text = text
python vba visio
1个回答
0
投票

我在 ShapeSheet 中没有找到任何看起来像正确设置的内容。

请查看ShapeLayout部分

ShapeLayout section

import win32com.client as w32 
visio = w32.Dispatch("visio.Application") 
visio.Visible = 1 
shape = visio.Activewindow.Page.Drop (visio.ConnectorToolDataObject, 5, 4)

visSectionObject = "1"
visRowShapeLayout = "23"
visSLOLineRouteExt = "19"
visSLORouteStyle = "10"

# Switch connector style 
# Right-Angle Connector
shape.CellsSRC(visSectionObject, visRowShapeLayout, visSLOLineRouteExt).FormulaU = "1"
shape.CellsSRC(visSectionObject, visRowShapeLayout, visSLORouteStyle).FormulaU = "1"
# Curved Connector
shape.CellsSRC(visSectionObject, visRowShapeLayout, visSLOLineRouteExt).FormulaU = "2"
# Straight Connector
shape.CellsSRC(visSectionObject, visRowShapeLayout, visSLOLineRouteExt).FormulaU = "1"
shape.CellsSRC(visSectionObject, visRowShapeLayout, visSLORouteStyle).FormulaU = "16"
© www.soinside.com 2019 - 2024. All rights reserved.