我正在制作一个PowerPoint插件,我试图将所有形状(文本,图表,表格)分组。但是当我选择表并尝试分组时,它会在VSTO中抛出错误。我也不能手工做。在网上搜索时,我发现这是微软方面的限制。谁来告诉我怎么解决这个问题。有没有其他的工作方式来实现分组功能与表对象?谁来帮帮我。
这是我在c#中使用VSTO尝试的代码。
string[] groupNames = new string[shapses.Count];
int index = 0;
foreach (Microsoft.Office.Interop.PowerPoint.Shape shape in shapses)
{
groupNames[index] = shape.Name;
index++;
}
Microsoft.Office.Interop.PowerPoint.Shape groupShape = targetSlide.Shapes.Range(groupNames).Group();
要将表与其他表分组,必须首先删除禁止分组的形状锁。默认的OOXML包含以下内容:
<p:cNvGraphicFramePr>
<a:graphicFrameLocks noGrp="1"/>
</p:cNvGraphicFramePr>
编辑为:
<p:cNvGraphicFramePr/>
然后你就可以对表进行分组了。