【问题标题】:Extract Bulleted Text From Powerpoint从 Powerpoint 中提取项目符号文本
【发布时间】:2015-09-26 09:21:34
【问题描述】:

我正在尝试从 powerpoint 幻灯片中提取项目符号文本。但是我找不到任何有用的功能可以提供有关当前行是否在项目符号列表中的信息。我尝试使用缩进级别来识别它,但我也觉得它没有用。

例如:

如果幻灯片包含如下文本:

Abcdefg...
. B
. C
  . D
     .E

这里有5个段落,如果得到每个段落的缩进级别,它将是:

Paragraph   IndentLevel
Abcdefg...   1
B            1
C            1
D            2
E            3

这里,前 3 段的缩进级别相同,但项目符号列表中只有 B 和 C,所以我的程序应该是 B、c、D、E。

这里,我没有办法判断这个段落是否以项目符号开头。

你能帮忙吗?

谢谢, 凯拉斯

编辑:

我用于检索文本的代码

public void analyzeText( PowerPoint.Shape shape )
{
    if( shape.HasTextFrame == Office.MsoTriState.msoTrue && shape.TextFrame.HasText == Office.MsoTriState.msoTrue )
    {
        PowerPoint.TextRange textRange = shape.TextFrame.TextRange;
        string text = textRange.Text;
        MessageBox.Show(text);
        for( int i=1; i<=textRange.Paragraphs().Count; i++)
        {
            MessageBox.Show("Paragram COunt : " + textRange.Paragraphs(i).Text + " Indent " + textRange.Paragraphs(i).IndentLevel);
        }
    }
}

【问题讨论】:

  • 您目前使用什么来提取文本?一些示例代码可能有用。
  • 添加了我正在使用的代码

标签: c# vba powerpoint office-interop


【解决方案1】:

您可以使用此方法来确定段落是否带有项目符号:

blnBullet = oShp.TextFrame.TextRange.Paragraphs(x).ParagraphFormat.Bullet

【讨论】:

    【解决方案2】:

    感谢 JamieG 的帮助。你的回答给了我提示。这是我解决这个问题的方法:

     PowerPoint.BulletFormat bulletFormat = textRange.Paragraphs(x).ParagraphFormat.Bullet;
    
        if( bulletFormat.Type == PowerPoint.PpBulletType.ppBulletNone )
                               // Not Bulleted
        else
                            // Bulleted
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-19
      • 2015-10-08
      • 2015-08-02
      • 1970-01-01
      • 1970-01-01
      • 2011-06-08
      相关资源
      最近更新 更多