首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用c#从.pptx或.ppt文件中提取列表或项目符号详细信息

如何使用c#从.pptx或.ppt文件中提取列表或项目符号详细信息
EN

Stack Overflow用户
提问于 2013-02-09 19:49:29
回答 2查看 1.1K关注 0票数 0

我正在使用Microsoft office Interope程序集来使用c#从.pptx和.ppt文件中提取特征。我能够提取关于形状、动画的细节,但是不能提取关于ppt或pptx由哪种类型的子弹组成的细节,或者哪张幻灯片包含子弹等。

请帮我找一下这个。提前谢谢。

EN

回答 2

Stack Overflow用户

发布于 2013-02-10 07:32:12

在VBA中,您可以这样检查幻灯片1中的项目符号

代码语言:javascript
复制
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将显示可用的属性。

票数 0
EN

Stack Overflow用户

发布于 2013-03-07 05:44:25

有几种方法。在下面的代码中,您可以看到可以在程序中访问的文本的属性:

代码语言:javascript
复制
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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14787807

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档