Documentation
¶
Index ¶
- type CustomStyle
- type Format
- type ParagraphProperties
- func (p *ParagraphProperties) Align(align string) *ParagraphProperties
- func (p *ParagraphProperties) IndCustom(leftChars, rightChars shared.Twip) *ParagraphProperties
- func (p *ParagraphProperties) IndFirst() *ParagraphProperties
- func (p *ParagraphProperties) IndHang() *ParagraphProperties
- func (p *ParagraphProperties) LineSpace(before, after shared.Twip) *ParagraphProperties
- func (p *ParagraphProperties) SetHead(styleId int64) *ParagraphProperties
- func (p *ParagraphProperties) XLineSpace(x float64) *ParagraphProperties
- type RunProperties
- func (r *RunProperties) HighlightColor(color any) *RunProperties
- func (r *RunProperties) SetBold() *RunProperties
- func (r *RunProperties) SetColor(color any) *RunProperties
- func (r *RunProperties) SetFont(font ...string) *RunProperties
- func (r *RunProperties) SetItalic() *RunProperties
- func (r *RunProperties) SetSize(size shared.Twip) *RunProperties
- func (r *RunProperties) SetSpace(size shared.Twip) *RunProperties
- func (r *RunProperties) SetUnderLine(name string) *RunProperties
- type StyleName
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CustomStyle ¶
type CustomStyle struct {
XMLName xml.Name `xml:"w:style"`
Type string `xml:"w:type,attr,omitempty"`
Id int64 `xml:"w:styleId,attr,omitempty"`
DefaultId int64 `xml:"w:default,attr,omitempty"`
Flg string `xml:"w:customStyle,attr,omitempty"`
StyleName *StyleName
Format *Format
ParagraphStyle *ParagraphProperties
TextStyle *RunProperties
// contains filtered or unexported fields
}
CustomStyle 自定义样式
func NewCustomStyle ¶
func NewCustomStyle(name, styleType string) CustomStyle
NewCustomStyle 创建自定义样式
styleType 样式类型,可选:character|paragraph|tab|...
func (*CustomStyle) DefaultStyle ¶
func (c *CustomStyle) DefaultStyle() map[string]*CustomStyle
DefaultStyle 添加默认段落样式
系统调用
type ParagraphProperties ¶
type ParagraphProperties struct {
XMLName xml.Name `xml:"w:pPr,omitempty"`
Spacing *spacing
Ind *ind
Justification *justification
Shade *shade
Kern *kern
PStyle *pStyle
TextAlignment *textAlignment
AdjustRightInd *adjustRightInd
SnapToGrid *snapToGrid
OverflowPunct *overflowPunct
WidowControl *widowControl
RPR *RunProperties
// contains filtered or unexported fields
}
ParagraphProperties 段落样式
func (*ParagraphProperties) Align ¶
func (p *ParagraphProperties) Align(align string) *ParagraphProperties
Align 段落对齐方式
left:左对齐。center:居中对齐。 right:右对齐。both:两端对齐。distribute:分散对齐。 shared.AlignArguments...
func (*ParagraphProperties) IndCustom ¶
func (p *ParagraphProperties) IndCustom(leftChars, rightChars shared.Twip) *ParagraphProperties
IndCustom 自定义缩进
leftChars:左缩进字符数量 shared.Char() rightChars:右缩进字符数量 shared.Char()
func (*ParagraphProperties) IndFirst ¶
func (p *ParagraphProperties) IndFirst() *ParagraphProperties
IndFirst 首行缩进,默认2字符
func (*ParagraphProperties) IndHang ¶
func (p *ParagraphProperties) IndHang() *ParagraphProperties
IndHang 悬挂缩进,默认2字符
func (*ParagraphProperties) LineSpace ¶ added in v1.0.0
func (p *ParagraphProperties) LineSpace(before, after shared.Twip) *ParagraphProperties
LineSpace 设置行间距
before:段前间距行数 shared.line() after:段后间距行数 shared.line()
func (*ParagraphProperties) SetHead ¶
func (p *ParagraphProperties) SetHead(styleId int64) *ParagraphProperties
SetHead 设置标题级别
styleId:自定义样式或默认样式id,默认如下: Normal :1 heading 1 :2 heading 2 :3 heading 3 :4 heading 4 :5 character :6
func (*ParagraphProperties) XLineSpace ¶ added in v1.0.0
func (p *ParagraphProperties) XLineSpace(x float64) *ParagraphProperties
XLineSpace 设置x倍行距
type RunProperties ¶
type RunProperties struct {
XMLName xml.Name `xml:"w:rPr,omitempty"`
Fonts *fonts
BCs *boldCs
Bold *bold
ICs *italicCs
Italic *italic
Highlight *highlight
Color *colors
Size *fontSize
SizeCs *fontSizeCs
Spacing *spacing
RStyle *rStyle
Shade *shade
Kern *kern
Underline *underline
VertAlign *vertAlign
Lang *lang
}
RunProperties 文本样式
func (*RunProperties) HighlightColor ¶
func (r *RunProperties) HighlightColor(color any) *RunProperties
HighlightColor 高亮显示
color: 可输入标准颜色英文字符或直接在调用颜色库 shared.ColorLib 中的颜色
func (*RunProperties) SetColor ¶
func (r *RunProperties) SetColor(color any) *RunProperties
SetColor 设置字体颜色
color: shared.RGB , 000000-FFFFFF, shared.ColorLib.Red
func (*RunProperties) SetFont ¶
func (r *RunProperties) SetFont(font ...string) *RunProperties
SetFont 设置文本字体
font:可以输入单个字体样式 或 依次属于ASCII,EastAsia,HAnsi,Cs,Hint样式
Example:
SetFont("楷体")
SetFont("楷体", "楷体", "楷体", "楷体", "eastAsia")
func (*RunProperties) SetSize ¶
func (r *RunProperties) SetSize(size shared.Twip) *RunProperties
SetSize 字号
size: shared.Twip 可选: shared.Cm() | shared.Mm() | shared.Pt() | shared.Inch() | shared.Wx()
func (*RunProperties) SetSpace ¶
func (r *RunProperties) SetSpace(size shared.Twip) *RunProperties
SetSpace 字符间距调整
size: twip = shared.Cm() | shared.Mm() | shared.Pt() | shared.Inch() | shared.Wx()
func (*RunProperties) SetUnderLine ¶
func (r *RunProperties) SetUnderLine(name string) *RunProperties
SetUnderLine 设置下划线
single 单下划线 words 仅为非空格字符添加下划线 double 双下划线 thick 粗下划线 dotted 点下划线 dottedHeavy 粗点下划线 dash 虚线下划线 dashedHeavy 粗虚线下划线 dashLong 长虚线下划线 dashLongHeavy 粗长虚线下划线 dotDash 虚线点下划线 dashDotHeavy 粗虚线点下划线 dotDotDash 破折号-点-点下划线 dashDotDotHeavy 粗破折号-点-点下划线 wave 波浪下划线 wavyHeavy 粗波浪下划线 wavyDouble 双重波浪下划线 none 无
Click to show internal directories.
Click to hide internal directories.