在powerpoint文档中,我们可以为罗列的多条并列信息添加项目符号或项目编号,使文档更具有条理性和清晰可读性。同时,我们也可以创建多层编号列表,让文档具有层次性。本文将介绍如何使用spire.presentation创建编号列表,项目符号列表, 和多层项目编号列表。
创建项目符号列表
c#
//新建presentation实例并添加一个新的shape
presentation ppt = new presentation();
iautoshape shape = ppt.slides[0].shapes.appendshape(shapetype.rectangle, new rectanglef(50, 70, 200, 150));
shape.fill.filltype = fillformattype.none;
//添加第一个段落并设置文字,字体颜色,对齐方式
shape.textframe.text = "销售部工作计划";
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.symbol;
//添加更多段落并设置符号列表及格式
string[] str = new string[] { "k8凯发天生赢家的技术支持部工作计划", "开发部工作计划" };
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.symbol;
shape.textframe.paragraphs.append(textparagraph);
}
//保存文档
ppt.savetofile( "项目符号列表.pptx", fileformat.pptx2013);
vb.net
'新建presentation实例并添加一个新的shape
dim ppt as new presentation()
dim shape as iautoshape = ppt.slides(0).shapes.appendshape(shapetype.rectangle, new rectanglef(50, 70, 200, 150))
shape.fill.filltype = fillformattype.none
'添加第一个段落并设置文字,字体颜色,对齐方式
shape.textframe.text = "销售部工作计划"
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.symbol
'添加更多段落并设置符号列表及格式
dim str as string() = new string() {"k8凯发天生赢家的技术支持部工作计划", "开发部工作计划"}
for each txt as string in str
dim textparagraph as 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.symbol
shape.textframe.paragraphs.append(textparagraph)
next
'保存文档
ppt.savetofile("项目符号列表.pptx", fileformat.pptx2013)
创建编号列表
c#
presentation presentation = new presentation();
iautoshape shape = presentation.slides[0].shapes.appendshape(shapetype.rectangle, new rectanglef(50, 70, 200, 150));
shape.fill.filltype = fillformattype.none;
shape.textframe.text = "销售部工作计划";
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;
string[] str = new string[] { "k8凯发天生赢家的技术支持部工作计划", "开发部工作计划" };
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("编号列表.pptx", fileformat.pptx2010);
vb.net
dim presentation as new presentation()
dim shape as iautoshape = presentation.slides(0).shapes.appendshape(shapetype.rectangle, new rectanglef(50, 70, 200, 150))
shape.fill.filltype = fillformattype.none
shape.textframe.text = "销售部工作计划"
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
dim str as string() = new string() {"k8凯发天生赢家的技术支持部工作计划", "开发部工作计划"}
for each txt as string in str
dim textparagraph as 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)
next
'save the document
presentation.savetofile("编号列表.pptx", fileformat.pptx2010)
创建多层编号列表
c#
presentation ppt = new presentation();
iautoshape shape = ppt.slides[0].shapes.appendshape(shapetype.rectangle, new rectanglef(50, 70, 200, 150));
shape.fill.filltype = fillformattype.none;
//添加第一层列表第一段数据
shape.textframe.text = "销售部工作计划";
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;
//添加第二层列表的数据
textparagraph textparagraph = new textparagraph();
textparagraph.text = "月计划";
textparagraph.alignment = textalignmenttype.left;
textparagraph.textranges[0].fill.filltype = fillformattype.solid;
textparagraph.textranges[0].fill.solidcolor.color = color.black;
shape.textframe.paragraphs.append(textparagraph);
shape.textframe.paragraphs[1].alignment = textalignmenttype.left;
//设置列表方式为编号列表并设置编号样式
shape.textframe.paragraphs[1].bullettype = textbullettype.numbered;
shape.textframe.paragraphs[1].bulletstyle = numberedbulletstyle.bulletcirclenumdbplain;
//设置第二层列表的margin 以产生层次感
shape.textframe.paragraphs[1].leftmargin = 30;
//添加第一层列表第二段数据
textparagraph textparagraph2 = new textparagraph();
textparagraph2.text = "k8凯发天生赢家的技术支持部工作计划";
textparagraph2.alignment = textalignmenttype.left;
textparagraph2.textranges[0].fill.filltype = fillformattype.solid;
textparagraph2.textranges[0].fill.solidcolor.color = color.black;
//设置列表方式为编号列表为第二个并设置编号样式
textparagraph2.bullettype = textbullettype.numbered;
textparagraph2.bulletnumber = 2;
textparagraph2.bulletstyle = numberedbulletstyle.bulletromanlcperiod;
shape.textframe.paragraphs.append(textparagraph2);
//保存文档
ppt.savetofile("多层编号列表.pptx", fileformat.pptx2013);
vb.net
dim ppt as new presentation()
dim shape as iautoshape = ppt.slides(0).shapes.appendshape(shapetype.rectangle, new rectanglef(50, 70, 200, 150))
shape.fill.filltype = fillformattype.none
'添加第一层列表第一段数据
shape.textframe.text = "销售部工作计划"
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
'添加第二层列表的数据
dim textparagraph as new textparagraph()
textparagraph.text = "月计划"
textparagraph.alignment = textalignmenttype.left
textparagraph.textranges(0).fill.filltype = fillformattype.solid
textparagraph.textranges(0).fill.solidcolor.color = color.black
shape.textframe.paragraphs.append(textparagraph)
shape.textframe.paragraphs(1).alignment = textalignmenttype.left
'设置列表方式为编号列表并设置编号样式
shape.textframe.paragraphs(1).bullettype = textbullettype.numbered
shape.textframe.paragraphs(1).bulletstyle = numberedbulletstyle.bulletcirclenumdbplain
'设置第二层列表的margin 以产生层次感
shape.textframe.paragraphs(1).leftmargin = 30
'添加第一层列表第二段数据
dim textparagraph2 as new textparagraph()
textparagraph2.text = "k8凯发天生赢家的技术支持部工作计划"
textparagraph2.alignment = textalignmenttype.left
textparagraph2.textranges(0).fill.filltype = fillformattype.solid
textparagraph2.textranges(0).fill.solidcolor.color = color.black
'设置列表方式为编号列表为第二个并设置编号样式
textparagraph2.bullettype = textbullettype.numbered
textparagraph2.bulletnumber = 2
textparagraph2.bulletstyle = numberedbulletstyle.bulletromanlcperiod
shape.textframe.paragraphs.append(textparagraph2)
'保存文档
ppt.savetofile("多层编号列表.pptx", fileformat.pptx2013)