本文介绍了如何设置与SmartArt图形中的节点关联的图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SmartArt图形可以具有与节点"关联的图片(尽管仅某些SmartArt模板会使用它).我知道如何通过VBA/VSTO自动化设置节点的文本,但是我不知道如何设置图片.

SmartArt graphics can have pictures associated with the "nodes" (although this is only used by certain SmartArt templates). I know how to set the text of a node via VBA/VSTO automation, but I can't figure out how to set the picture.

能做到吗?

推荐答案

尝试类似的方法-如果您已经使用smartart在VBA中完成了任何工作,那么这应该是有道理的.

Try something like this - if you've done any work in VBA with smartart this should make sense.

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

希望如此!

这篇关于如何设置与SmartArt图形中的节点关联的图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 15:06