style

package
v0.0.0-...-dfdad10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2023 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdjustRightInd

type AdjustRightInd struct {
	XMLName xml.Name `xml:"w:adjustRightInd,omitempty"`
	Val     int      `xml:"w:val,attr"`
}

AdjustRightInd ...

type Bold

type Bold struct {
	XMLName xml.Name `xml:"w:b,omitempty"`
}

Bold 加粗

type BoldCs

type BoldCs struct {
	XMLName xml.Name `xml:"w:bCs,omitempty"`
}

BoldCs 复杂格式加粗

type Color

type Color struct {
	XMLName xml.Name `xml:"w:color,omitempty"`
	Val     string   `xml:"w:val,attr"`
}

Color 颜色

type CustomStyle

type CustomStyle struct {
	XMLName   xml.Name `xml:"w:style"`
	Type      string   `xml:"w:type,attr"`
	Id        int64    `xml:"w:styleId,attr"`
	Flg       string   `xml:"w:customStyle,attr"`
	StyleName *Name
	Format    *Format
	PPR       *ParagraphProperties
	RPR       *RunProperties
}

func (*CustomStyle) CreatePPR

func (c *CustomStyle) CreatePPR() *ParagraphProperties

func (*CustomStyle) CreateRPR

func (c *CustomStyle) CreateRPR() *RunProperties

type Fonts

type Fonts struct {
	XMLName  xml.Name `xml:"w:rFonts,omitempty"`
	ASCII    string   `xml:"w:ascii,attr,omitempty"`
	EastAsia string   `xml:"w:eastAsia,attr,omitempty"`
	HAnsi    string   `xml:"w:hAnsi,attr,omitempty"`
	Cs       string   `xml:"w:cs,attr,omitempty"`
	Hint     string   `xml:"w:hint,attr,omitempty"`
}

Fonts 字体类型

type Format

type Format struct {
	XMLName xml.Name `xml:"w:qFormat,omitempty"`
}

w:qFormat

type Highlight

type Highlight struct {
	XMLName xml.Name `xml:"w:highlight,omitempty"`
	Val     string   `xml:"w:val,attr,omitempty"`
}

Highlight 高亮

type Ind

type Ind struct {
	XMLName xml.Name `xml:"w:ind,omitempty"`

	LeftChars      int `xml:"w:leftChars,attr,omitempty"`
	Left           int `xml:"w:left,attr,omitempty"`
	FirstLineChars int `xml:"w:firstLineChars,attr,omitempty"`
	FirstLine      int `xml:"w:firstLine,attr,omitempty"`
	HangingChars   int `xml:"w:hangingChars,attr,omitempty"`
	Hanging        int `xml:"w:hanging,attr,omitempty"`
}

Ind 缩进

type Italic

type Italic struct {
	XMLName xml.Name `xml:"w:i,omitempty"`
}

Italic 斜体

type ItalicCs

type ItalicCs struct {
	XMLName xml.Name `xml:"w:iCs,omitempty"`
}

ItalicCs 复杂格式斜体

type Justification

type Justification struct {
	XMLName xml.Name `xml:"w:jc,omitempty"`
	Val     string   `xml:"w:val,attr"`
}

Justification 对齐方式

w:jc 属性的取值可以是以下之一:
	start:左对齐。
	center:居中对齐。
	end:右对齐。
	both:两端对齐。
	distribute:分散对齐。

type Kern

type Kern struct {
	XMLName xml.Name `xml:"w:kern,omitempty"`
	Val     int64    `xml:"w:val,attr"`
}

Kern ...

type Kinsoku

type Kinsoku struct {
	XMLName xml.Name `xml:"w:kinsoku,omitempty"`
	Val     int      `xml:"w:val,attr"`
}

Kinsoku ...

type Name

type Name struct {
	XMLName xml.Name `xml:"w:name,omitempty"`
	Val     string   `xml:"w:val,attr"`
}

type OverflowPunct

type OverflowPunct struct {
	XMLName xml.Name `xml:"w:overflowPunct,omitempty"`
	Val     int      `xml:"w:val,attr"`
}

OverflowPunct ...

type ParagraphProperties

type ParagraphProperties struct {
	XMLName        xml.Name `xml:"w:pPr,omitempty"`
	Spacing        *Spacing
	Ind            *Ind
	Justification  *Justification
	Shade          *Shade
	Kern           *Kern
	Style          *Style
	TextAlignment  *TextAlignment
	AdjustRightInd *AdjustRightInd
	SnapToGrid     *SnapToGrid
	Kinsoku        *Kinsoku
	OverflowPunct  *OverflowPunct
}

func (*ParagraphProperties) Align

Align 对齐方式 left:左对齐。center:居中对齐。 right:右对齐。both:两端对齐。distribute:分散对齐。

func (*ParagraphProperties) IndCustom

func (p *ParagraphProperties) IndCustom(ind Ind) *ParagraphProperties

IndCustom 自定义缩进

func (*ParagraphProperties) IndFirst

IndFirst 首行缩进

func (*ParagraphProperties) LineSpce

func (p *ParagraphProperties) LineSpce(before, after int) *ParagraphProperties

LineSpce 设置行间距

func (*ParagraphProperties) XSpce

XSpce 设置x倍行距

type RGB

type RGB struct {
	RGB [3]uint8
	Hex string
}

RGB 颜色 对应 rgb与16进制 RGB.RGB 大小为3的 uint8 数组 RGB.Hex 对应颜色的16进制,不支持透明度

func (*RGB) Color

func (r *RGB) Color() string

Color 获取颜色值

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     *Color
	Size      *Size
	SizeCs    *SizeCs
	Spacing   *Spacing
	RunStyle  *RunStyle
	Style     *Style
	Shade     *Shade
	Kern      *Kern
	Underline *Underline
	VertAlign *VertAlign
}

func (*RunProperties) SetBold

func (r *RunProperties) SetBold() *RunProperties

SetBold Bold ...

func (*RunProperties) SetColor

func (r *RunProperties) SetColor(color ...any) *RunProperties

SetColor allows to set run color

color: [3]uint8{0-255,0-255,0-255} , 000000-FFFFFF

func (*RunProperties) SetFont

func (r *RunProperties) SetFont(font ...string) *RunProperties

SetFont sets the font of the run

font []string = []string{"楷体"} 或
	[]string{ASCII,EastAsia,HAnsi,Cs,Hint}

func (*RunProperties) SetSize

func (r *RunProperties) SetSize(size float64) *RunProperties

SetSize 字号

type RunStyle

type RunStyle struct {
	XMLName xml.Name `xml:"w:rStyle,omitempty"`
	Val     string   `xml:"w:val,attr"`
}

RunStyle 包含文本块样式

type Shade

type Shade struct {
	XMLName       xml.Name `xml:"w:shd,omitempty"`
	Val           string   `xml:"w:val,attr,omitempty"`
	Color         string   `xml:"w:color,attr,omitempty"`
	Fill          string   `xml:"w:fill,attr,omitempty"`
	ThemeFill     string   `xml:"w:themeFill,attr,omitempty"`
	ThemeFillTint string   `xml:"w:themeFillTint,attr,omitempty"`
}

Shade 阴影

type Size

type Size struct {
	XMLName xml.Name `xml:"w:sz,omitempty"`
	Val     string   `xml:"w:val,attr"`
}

Size 大小

type SizeCs

type SizeCs struct {
	XMLName xml.Name `xml:"w:szCs,omitempty"`
	Val     string   `xml:"w:val,attr"`
}

SizeCs 复杂样式大小

type SnapToGrid

type SnapToGrid struct {
	XMLName xml.Name `xml:"w:snapToGrid,omitempty"`
	Val     int      `xml:"w:val,attr"`
}

SnapToGrid ...

type Spacing

type Spacing struct {
	XMLName xml.Name `xml:"w:spacing,omitempty"`

	Val int `xml:"w:val,attr,omitempty"`

	BeforeLines int    `xml:"w:beforeLines,attr,omitempty"`
	Before      int    `xml:"w:before,attr,omitempty"`
	AfterLines  int    `xml:"w:afterLines,attr,omitempty"`
	After       int    `xml:"w:after,attr,omitempty"`
	Line        int    `xml:"w:line,attr,omitempty"`
	LineRule    string `xml:"w:lineRule,attr,omitempty"`
}

Spacing 行距

type Style

type Style struct {
	XMLName xml.Name `xml:"w:pStyle,omitempty"`
	Val     string   `xml:"w:val,attr"`
}

Style contains styling for a paragraph

type TextAlignment

type TextAlignment struct {
	XMLName xml.Name `xml:"w:textAlignment,omitempty"`
	Val     string   `xml:"w:val,attr"`
}

TextAlignment ...

type Underline

type Underline struct {
	XMLName xml.Name `xml:"w:u,omitempty"`
	Val     string   `xml:"w:val,attr,omitempty"`
}

Underline 下划线

type VertAlign

type VertAlign struct {
	XMLName xml.Name `xml:"w:vertAlign,omitempty"`
	Val     string   `xml:"w:val,attr"`
}

VertAlign 垂直对齐

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL