Number in current number list item


#1

Hi all,
I was wondering if while iterating a ParagraphCollection, I can know the actual number that will appear in final report. Please consider situations that “NumberedBulletStartWith” was used and that I have many numbered lists in that collection.
Kind regards,
FB


#2

@fireball4,

I have tried understanding the issue on our end and have not been able to comprehend your requirements. Can you please provide the details of your requirement in the form of sample presentation and snapshot that you are looking in Aspose.Slides to offer you.


#3

Hello,

Please find here (193.5 KB) an example of what I’m trying to do.

I have the following data in my AutoShape
1.One
2.Two
6.Three
7.Four
8.Five

And I need to print in console, both the “Three” and the number “6” in front of it.

I hope that now is clearer.

Kind regards,
FB


#4

@fireball4,

Can you please try to use following sample code and share feedback with us if there is still an issue.

using (var presentation = new Presentation(“Test.pptx”))
{
var shape = presentation.Slides[0].Shapes.OfType().First(x => x.Name.Equals(“Content Placeholder 2”));

short currentLevel = 0;
short currentStartsWith = 0;
foreach (var paragraph in shape.TextFrame.Paragraphs)
{
    Console.WriteLine(paragraph.Text); // This print just the text, but I also need to print the number.
    var effective = paragraph.ParagraphFormat.GetEffective();
    if (effective.Bullet.Type == BulletType.Numbered)
    {
        if(effective.Bullet.NumberedBulletStartWith != currentStartsWith)
        {
            currentStartsWith = effective.Bullet.NumberedBulletStartWith;
            currentLevel = 0; // reset if startsWith changed
        }

        Console.WriteLine(effective.Bullet.NumberedBulletStartWith + currentLevel++);
    }
}

}


#5

Hey,
I was hoping that there would be an easier way, but this will do the trick.
Thank you for your help.
FB


#6

@fireball4,

It’s good to know things are resolved on your end.