工业级Word控件 Spire.Doc系列教程:C# 创建 Word 艺术字

在编辑word文档时,我们会为文档添加艺术字,让文档更美观和具有吸引力。Spire.Doc里通过ShapeType枚举类型,我们可以添加多种类型的艺术字,并实例化一个ShapeObject来设置艺术字的类型,并添加艺术字内容和设置其样式。 本文将详细介绍如何使用Spire.Doc创建艺术字并设置样式和效果。

                                                 【下载Spire.Doc最新试用版

【C#】
//实例化一个word Document并添加一个section和段落
Document doc = new Document();
Section section = doc.AddSection(); 
Paragraph paragraph = section.AddParagraph();

//添加一个Shape,并设置其大小和样式
ShapeObject shape = paragraph.AppendShape(240, 60, ShapeType.TextWave);

//设置shape的位置
shape.VerticalPosition = 80;
shape.HorizontalPosition = 100;

//写入艺术字文本和设置斜体
shape.WordArt.Text = "艺术字效果";
shape.WordArt.Italic = true;

//设置文字填充样式
shape.FillColor = System.Drawing.Color.Red;
shape.StrokeColor = System.Drawing.Color.Gray;
      
//保存文档        
doc.SaveToFile("Output.docx", FileFormat.Docx2013); 复制代码
【VB.NET】
Dim doc As New Document()

Dim section As Section = doc.AddSection()
Dim paragraph As Paragraph = section.AddParagraph()

Dim shape As ShapeObject = paragraph.AppendShape(240, 60, ShapeType.TextWave)
shape.VerticalPosition = 80
shape.HorizontalPosition = 100

shape.WordArt.Text = "艺术字效果"
shape.WordArt.Italic = True

shape.FillColor = System.Drawing.Color.Red
shape.StrokeColor = System.Drawing.Color.Gray

doc.SaveToFile("Output.docx", FileFormat.Docx2013)复制代码

效果图:

想看冰蓝更多产品教程吗?为你推荐:

                                                    Spire.PDF系列教程>>

                                                    Spire.XLS系列教程>>




转载于:https://juejin.im/post/5c983963e51d4522a227eb03

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值