无法取消组合 PowerPoint SmartArt 形状

本文关键字:PowerPoint SmartArt 形状 组合 取消组 取消 | 更新日期: 2023-09-27 18:30:37

我尝试从代码中取消对 SmartArt 形状的分组,但它总是导致错误:"只能为组访问此成员"。

但是,如果我右键单击 SmartArt 形状并取消分组,它正在工作。

我该如何解决这个问题?

我的代码是:

public void CreateSmartArt(PowerPoint.Shapes allShapes){     PowerPoint.Shape smartartShape = allShapes.AddSmartArt(IttPowerPoint.Instance.PowerPointApp.SmartArtLayouts["MyLayOut"], 0f, 0f, width, height);     Marshal.ReleaseComObject(smartartShape);智能艺术形状 = 空;}Public void UngroupSmartArt(PowerPoint.Shape shape){     尝试     {            形状。取消分组();     }     捕获(例外,例如)     {            MessageBox.Show(例如消息);     }}

注意:我正在使用VS Ultimate 2013,PowerPoint2013,C#

无法取消组合 PowerPoint SmartArt 形状

在 VBA 中,你会这样做,假设引用 osh 中的 smartart 形状:

osh.Copy
osh.Delete
Set osh = ActiveWindow.Selection.SlideRange(1).Shapes.PasteSpecial(ppPasteEnhancedMetafile)(1)
With osh.Ungroup
    .Ungroup
End With

将 SmartArt 形状复制到剪贴板将其从幻灯片中删除将其作为增强型图元文件粘贴回幻灯片上取消分组,然后取消结果分组。

瞧。 形状。

您需要在复制/删除智能艺术

之前拾取智能艺术的上/左坐标,然后将它们应用于粘贴的 EMF。

查看 Shape 对象的 Parent 和 ParentGroup 属性。这可能会解决您的问题。