无法取消对PowerPoint SmartArt Shape的分组 [英] Cannot ungroup a PowerPoint SmartArt Shape

查看:148
本文介绍了无法取消对PowerPoint SmartArt Shape的分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从代码中取消对SmartArt形状的分组,但始终会导致错误:该成员只能在组中访问".

I try to ungroup a SmartArt shape from code, but it always causes an error: "This member can only be accessed for a group".

但是,如果我右键单击SmartArt形状并将其取消分组,它就可以正常工作.

However, it's working, if I right click on the SmartArt shape, and ungroup it.

我该如何解决?

我的代码是:


public void CreateSmartArt(PowerPoint.Shapes allShapes)

{

     PowerPoint.Shape smartartShape = allShapes.AddSmartArt(IttPowerPoint.Instance.PowerPointApp.SmartArtLayouts["MyLayOut"], 0f, 0f, width, height);

     Marshal.ReleaseComObject(smartartShape); smartartShape = null;

}



Public void UngroupSmartArt(PowerPoint.Shape shape)

{

     try

     {

            shape.Ungroup();

     }

     catch (Exception ex)

     {

            MessageBox.Show(ex.Message);

     }
}

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

Note: I am using VS Ultimate 2013, PowerPoint2013, C#

推荐答案

在VBA中,您将这样做,假设在osh中引用了smartart形状:

In VBA, you'd do it like so, asssuming a reference to the smartart shape in osh:

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

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

Copy the SmartArt shape to the clipboard Delete it from the slide Paste it back onto the slide as an Enhanced Metafile Ungroup it then ungroup the result.

Voila.形状.

在复制/删除智能艺术品之前,您需要先获取智能艺术品的顶部/左侧坐标,然后将其应用于粘贴的EMF.

You'll want to pick up the top/left coordinates of the Smart Art before copying/deleting it, then apply them to the pasted EMF.

这篇关于无法取消对PowerPoint SmartArt Shape的分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆