段落格式
段落的类型为RtfParagraph。
RtfParagraph的属性有:
属性 | 说明 |
Font | 文本字体 |
ForeColor | 文本颜色 |
FirstLineIndent | 首行缩进值 |
SpaceBetweenLines | 行间距 |
SpacesBefore | 段落前间距,也就是和前一个段落之间的间距 |
SpacesAfter | 段落后间距,也就是和后一个段落之间的间距 |
RightIndent | 段落的右缩进值 |
LeftIndent | 段落的左缩进值 |
Alignment |
落文字水平方向的排列方式,RtfHorizontalAlignment型枚举,可选值有: Undefined:未定义对齐方式 Left:左对齐 Right:右对齐 Center:居中对齐 Justify:两端对齐 |
示例
Dim
wdc
As
New
WordCreator()
Dim
fl
As
String
=
"c:\temp\test.docx"
Dim
txt
As
String
For
i
As
Integer
= 1
To
5
txt = txt &
"Foxtable不仅是一个优秀的应用软件,同时又是一个高效率的开发工具。"
Next
With
wdc.AddParagraph(txt)
.ForeColor = Color.Green
.Font =
New
Font("微软雅黑",
9)
.FirstLineIndent = 20
.SpaceBetweenLines = 10
.Alignment = Word.RtfHorizontalAlignment.Justify
End
With
wdc.Save(fl)
Process.Start(fl)
生成的Word文件内容: