简体   繁体   中英

Extract Bulleted Text From Powerpoint

I am trying to extract bulleted text from powerpoint slides. But I couldn't find any helpful function which can provide information about if current line is in bullet list or not. I tried identifying it using indent level, but I dont find it useful either.

For example:

If slide contains text like:

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

In this, there are 5 paragraphs, if get indent level of each paragraph it will come as :

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

Here, first 3 paragraph have same indent level, but only B and C are in bulleted list, so my program should B, c, D, E.

Here, i dont have any way to figure out if this para starts with bullet or not.

Can you please help?

Thanks, Kailas

Edit:

Code that I am using for retrieving text

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);
        }
    }
}

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

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

Thanks JamieG for helping out. Your answer gave me hint. Here is how I was able to solve this problem:

 PowerPoint.BulletFormat bulletFormat = textRange.Paragraphs(x).ParagraphFormat.Bullet;

    if( bulletFormat.Type == PowerPoint.PpBulletType.ppBulletNone )
                           // Not Bulleted
    else
                        // Bulleted

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM