我正在使用Microsoft office Interope程序集来使用c#从.pptx和.ppt文件中提取特征。我能够提取关于形状、动画的细节,但是不能提取关于ppt或pptx由哪种类型的子弹组成的细节,或者哪张幻灯片包含子弹等。
请帮我找一下这个。提前谢谢。
发布于 2013-02-10 07:32:12
在VBA中,您可以这样检查幻灯片1中的项目符号
Dim oSh As Shape
Dim x As Long ' Integer in C#?
For Each oSh In ActivePresentation.Slides(1).Shapes
With oSh
If .HasTextFrame Then
If .TextFrame.HasText Then
With .TextFrame2.TextRange
For x = 1 To .Paragraphs.Count
Debug.Print .Paragraphs(x).ParagraphFormat.Bullet.[Various properties]
Next
End With
End If
End If
End With
Next查看PPT VBA编辑器中的代码。当您在上面的项目符号后键入圆点时,intellisense将显示可用的属性。
发布于 2013-03-07 05:44:25
有几种方法。在下面的代码中,您可以看到可以在程序中访问的文本的属性:
ppTextBox.TextFrame2.TextRange.ParagraphFormat.Bullet.Type =
Office.MsoBulletType.msoBulletNumbered;
ppTextBox.TextFrame2.TextRange.ParagraphFormat.Bullet.Style =
Office.MsoNumberedBulletStyle.msoBulletAlphaLCParenBoth;
ppTextBox.TextFrame2.TextRange.ParagraphFormat.Bullet.StartValue = 4;
ppTextBox.TextFrame2.TextRange.ParagraphFormat.Bullet.UseTextColor =
Office.MsoTriState.msoTrue;
ppTextBox.TextFrame2.TextRange.ParagraphFormat.Bullet.UseTextFont =
Office.MsoTriState.msoTrue;其中ppTextBox是shape对象,请注意使用TextFrame2而不是TextFrame。您可以根据枚举列表Office.MsoBulletType查询ParagraphFormat.Bullt.Type,以查看已应用的是哪一个。
有关使用C#在powerpoint中处理文本的更多详细信息,请查看this page。
https://stackoverflow.com/questions/14787807
复制相似问题