How to Set Bullet Style in a PowerPoint Document in C#

Bullets and numbering can format several paragraphs as a list. Bullets are useful for unordered lists in which each item is not significantly more important than others. Numbering is useful for lists in which each item is part of a sequence of steps and ought to be followed in that order.

Spire.Presentation for .NET, as a robust component for developers to manipulate PowerPoint slides, enables users to set style, color, and size of the bullets or numberings as well as spacing between a bullet or numbering and its text. You can learn how to insert bullets in PowerPoint documents using C# by following the directions included in the tutorial below.

Step 1: Create a Presentation instance.

Presentation presentation = new Presentation();

Step 2: Append a shape to hold the bulleted list.

IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 70, 200, 150));
shape.Fill.FillType = FillFormatType.None;

Step 3: Add text to TextFrame as a first paragraph and format the text.

shape.TextFrame.Text = "Spire.Office for .NET";                
shape.TextFrame.TextRange.Fill.FillType = FillFormatType.Solid;
shape.TextFrame.TextRange.Fill.SolidColor.Color = Color.Black;
shape.TextFrame.Paragraphs[0].Alignment = TextAlignmentType.Left;

Step 4: Set the bullet type as numbered and set the bullet character as lowercase roman numerals.

shape.TextFrame.Paragraphs[0].BulletType = TextBulletType.Numbered;
shape.TextFrame.Paragraphs[0].BulletStyle = NumberedBulletStyle.BulletRomanLCPeriod;

Step 5: Add three more bulleted paragraphs to TextFrame.

string[] str = new string[] {"Spire.Doc for .NET", "Spire.XLS for .NET", "Spire.PDF for .NET" };
foreach (string txt in str)
{
    TextParagraph textParagraph = new TextParagraph();
    textParagraph.Text = txt;
    textParagraph.Alignment = TextAlignmentType.Left;
    textParagraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
    textParagraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;

    textParagraph.BulletType = TextBulletType.Numbered;
    textParagraph.BulletStyle = NumberedBulletStyle.BulletRomanLCPeriod;
    shape.TextFrame.Paragraphs.Append(textParagraph);
}

Step 6: Save the document.

presentation.SaveToFile("bullets.pptx", FileFormat.Pptx2010);

The result would be like this:

Set Bullet Style in a PPT Document

Full C# codes:

//create PPT document
Presentation presentation = new Presentation();

//append new shape
IAutoShape shape = presentation.Slides[0].Shapes.AppendShape(ShapeType.Rectangle, new RectangleF(50, 70, 200, 150));
shape.Fill.FillType = FillFormatType.None;

//add the first paragraph with bulleted style
shape.TextFrame.Text = "Spire.Office for .NET";                
shape.TextFrame.TextRange.Fill.FillType = FillFormatType.Solid;
shape.TextFrame.TextRange.Fill.SolidColor.Color = Color.Black;
shape.TextFrame.Paragraphs[0].Alignment = TextAlignmentType.Left;
shape.TextFrame.Paragraphs[0].BulletType = TextBulletType.Numbered;
shape.TextFrame.Paragraphs[0].BulletStyle = NumberedBulletStyle.BulletRomanLCPeriod;

//add more bulleted paragraphs
string[] str = new string[] {"Spire.Doc for .NET", "Spire.XLS for .NET", "Spire.PDF for .NET" };
foreach (string txt in str)
{
    TextParagraph textParagraph = new TextParagraph();
    textParagraph.Text = txt;
    textParagraph.Alignment = TextAlignmentType.Left;
    textParagraph.TextRanges[0].Fill.FillType = FillFormatType.Solid;
    textParagraph.TextRanges[0].Fill.SolidColor.Color = Color.Black;

    textParagraph.BulletType = TextBulletType.Numbered;
    textParagraph.BulletStyle = NumberedBulletStyle.BulletRomanLCPeriod;
    shape.TextFrame.Paragraphs.Append(textParagraph);
}

//save the document
presentation.SaveToFile("bullets.pptx", FileFormat.Pptx2010);