Search code examples
c#vbapowerpointoffice-interop

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

Solution

  • 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