使用Spire.Presentation,可以在PPT幻灯片中生成项目符号列表以及多级项目编号列表。此外,也可以通过自定义方式来设置项目符号样式。Spire.Presentation提供了BulletPicture属性,允许用户通过加载图片来作为项目符号样式。本文将介绍具体的实现方法。
C#
//实例化Presentation类的对象
Presentation ppt = new Presentation();
//加载PPT测试文档
ppt.LoadFromFile("test.pptx");
//获取第1张幻灯片中的第1个shape
IAutoShape shape = ppt.Slides[0].Shapes[0] as IAutoShape;
//遍历shape中的所有段落
foreach (TextParagraph paragraph in shape.TextFrame.Paragraphs)
{
    //设置项目符号样式为图片
    paragraph.BulletType = TextBulletType.Picture;
    //加载图片
    Image bulletPicture = Image.FromFile(@"g.png");
    //添加图片作为项目符号样式
    paragraph.BulletPicture.EmbedImage = ppt.Images.Append(bulletPicture);
}
//保存文档
ppt.SaveToFile("output.pptx", FileFormat.Pptx2010);VB.NET
'实例化Presentation类的对象 Dim ppt As New Presentation() '加载PPT测试文档
ppt.LoadFromFile("test.pptx")
'获取第1张幻灯片中的第1个shape Dim shape As IAutoShape = TryCast(ppt.Slides(0).Shapes(0),IAutoShape) '遍历shape中的所有段落
For Each paragraph As TextParagraph In shape.TextFrame.Paragraphs
	'设置项目符号样式为图片 paragraph.BulletType = TextBulletType.Picture '加载图片
	Dim bulletPicture As Image = Image.FromFile("g.png")
	'添加图片作为项目符号样式 paragraph.BulletPicture.EmbedImage = ppt.Images.Append(bulletPicture) Next '保存文档
ppt.SaveToFile("output.pptx", FileFormat.Pptx2010)项目符号样式添加效果:

 



 
					



