SmartArt图形可以包含与“节点”关联的图片(尽管这仅适用于某些SmartArt模板)。我知道如何通过VBA / VSTO自动化设置节点的文本,但我无法弄清楚如何设置图片。
可以吗?
答案 0 :(得分:2)
尝试这样的事情 - 如果你在使用smartart的VBA中做过任何工作,这应该是有意义的。
Dim oSALayout As SmartArtLayout
Dim QNode As SmartArtNode
Dim oShp As Shape
Set oSALayout = Application.SmartArtLayouts(91) 'reference to organization chart
Set oShp = Chart.Shapes.AddSmartArt(oSALayout, ileft, 2, iWidth, iHeight)
Set QNode = oShp.SmartArt.AllNodes.Add
...
' note that there may be more than one shape associated with each node, I found that those org chart/smart art layouts with a specific "picture box" typically use Shapes.Item(2)
With QNode.Shapes.Item(1).Fill
.Visible = msoTrue
.UserPicture "c:\somepath\picture.jpg"
.TextureTile = msoFalse
End With
希望有意义!