spire.presentation for .net支持图片、文字阴影效果。在 一文中,介绍了图片阴影效果的实现方法,在本篇示例中将介绍设置ppt文字阴影效果的方法。
c#
//实例化presentation类,获取第一张幻灯片
presentation presentation = new presentation();
islide slide = presentation.slides[0];
//在幻灯片指定位置绘制指定大小的矩形形状,并设置填形状填充
iautoshape shape = slide.shapes.appendshape(shapetype.rectangle, new rectanglef(80, 40, 500,350));
shape.shapestyle.linecolor.color = color.white;
shape.fill.filltype = spire.presentation.drawing.fillformattype.none;
//绘制文本内容到形状,并设置文本格式
shape.appendtextframe("如何通过使用spire.presentation 来设置ppt文字阴影效果");
shape.textframe.paragraphs[0].textranges[0].latinfont = new textfont("隶书");
shape.textframe.paragraphs[0].textranges[0].fill.filltype = fillformattype.solid;
shape.textframe.paragraphs[0].textranges[0].fill.solidcolor.color = color.black;
shape.textframe.paragraphs[0].textranges[0].fontheight = 40;
//实例化outershadoweffect类,设置文字阴影效果
spire.presentation.drawing.outershadoweffect shadow = new spire.presentation.drawing.outershadoweffect();
shadow.blurradius = 0;
shadow.direction = 50;
shadow.distance = 10;
shadow.colorformat.color = color.gray;
shape.textframe.textrange.effectdag.outershadoweffect = shadow;
//保存文档
presentation.savetofile("result.pptx", fileformat.pptx2010);
vb.net
'实例化presentation类,获取第一张幻灯片
dim presentation as new presentation()
dim slide as islide = presentation.slides(0)
'在幻灯片指定位置绘制指定大小的矩形形状,并设置填形状填充
dim shape as iautoshape = slide.shapes.appendshape(shapetype.rectangle, new rectanglef(80, 40, 500, 350))
shape.shapestyle.linecolor.color = color.white
shape.fill.filltype = spire.presentation.drawing.fillformattype.none
'绘制文本内容到形状,并设置文本格式
shape.appendtextframe("如何通过使用spire.presentation 来设置ppt文字阴影效果")
shape.textframe.paragraphs(0).textranges(0).latinfont = new textfont("隶书")
shape.textframe.paragraphs(0).textranges(0).fill.filltype = fillformattype.solid
shape.textframe.paragraphs(0).textranges(0).fill.solidcolor.color = color.black
shape.textframe.paragraphs(0).textranges(0).fontheight = 40
'实例化outershadoweffect类,设置文字阴影效果
dim shadow as new spire.presentation.drawing.outershadoweffect()
shadow.blurradius = 0
shadow.direction = 50
shadow.distance = 10
shadow.colorformat.color = color.gray
shape.textframe.textrange.effectdag.outershadoweffect = shadow
'保存文档
presentation.savetofile("result.pptx", fileformat.pptx2010)
ppt文字阴影添加效果: