Documentation ¶
Index ¶
- type Body
- type BodyChild
- type BodyChildType
- type Break
- type Color
- type ContentTypes
- type ContentTypesDefaultItem
- type ContentTypesOverrideItem
- type CoreProperties
- type CustomProperties
- type CustomPropertyItem
- type DocDefaults
- type Document
- type Docx
- type ExtendedProperties
- type Indent
- type Language
- type LatentStyles
- type LsdException
- type PackageRelationshipItem
- type PackageRelationships
- type Paragraph
- type ParagraphChild
- type ParagraphChildType
- type ParagraphProperty
- type PartRelationship
- type Run
- type RunChild
- type RunChildType
- type RunFonts
- type RunProperty
- func (rPr *RunProperty) Bold() *bool
- func (rPr *RunProperty) BoldCs() *bool
- func (rPr *RunProperty) Color() *Color
- func (rPr *RunProperty) ComplexScript() *bool
- func (rPr *RunProperty) DoubleStrikethrough() *bool
- func (rPr *RunProperty) EmphasisMark() *string
- func (rPr *RunProperty) FontKerning() *int
- func (rPr *RunProperty) Fonts() *RunFonts
- func (rPr *RunProperty) Imprint() *bool
- func (rPr *RunProperty) Italics() *bool
- func (rPr *RunProperty) ItalicsCs() *bool
- func (rPr *RunProperty) Lang() *Language
- func (rPr *RunProperty) Outline() *bool
- func (rPr *RunProperty) Position() *int
- func (rPr *RunProperty) Size() *int
- func (rPr *RunProperty) SizeCs() *int
- func (rPr *RunProperty) String() string
- func (rPr *RunProperty) UnmarshalXML(d *xml.Decoder, _ xml.StartElement) error
- type SectionProperty
- type StyleItem
- type Styles
- type Table
- type TableCell
- type TableCellProperty
- type TableRow
- type Text
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Body ¶
type Body struct {
Children []BodyChild
}
Body 对应主文档中的 <w:body>...</w:body>
func (*Body) UnmarshalXML ¶
UnmarshalXML 解析<body>元素
type BodyChild ¶
type BodyChild interface { String() string TypeName() BodyChildType }
BodyChild <body>中的元素:p、tbl、sectPr
type BodyChildType ¶
type BodyChildType uint8
const ( BodyTypeParagraph BodyChildType = iota BodyTypeTable BodyTypeSecPr )
type Break ¶
type Break struct {
Val *bool
}
func (*Break) TypeName ¶
func (b *Break) TypeName() RunChildType
type ContentTypes ¶
type ContentTypes struct { DefaultItems []ContentTypesDefaultItem `xml:"Default"` OverrideItem []ContentTypesOverrideItem `xml:"Override"` }
type ContentTypesDefaultItem ¶
type CoreProperties ¶
type CoreProperties struct { Created string `xml:"http://purl.org/dc/terms/ created"` Creator string `xml:"http://purl.org/dc/elements/1.1/ creator"` LastModifiedBy string `xml:"http://schemas.openxmlformats.org/pkg/2006/metadata/core-properties lastModifiedBy"` Modified string `xml:"http://purl.org/dc/terms/ modified"` Revision int `xml:"http://schemas.openxmlformats.org/pkg/2006/metadata/core-properties revision"` }
CoreProperties is the `Application-Defined File Properties part` => docProps/core.xml
type CustomProperties ¶
type CustomProperties struct { Xmlns string `xml:"xmlns,attr"` Children []CustomPropertyItem `xml:"property"` }
CustomProperties is the `Application-Defined File Properties part` => docProps/custom.xml
type CustomPropertyItem ¶
type CustomPropertyItem struct { Fmtid string `xml:"fmtid,attr"` Pid string `xml:"pid,attr"` Name string `xml:"name,attr"` Lpwstr string `xml:"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes lpwstr"` }
CustomPropertyItem is the item of the docProps/custom.xml file
type DocDefaults ¶
type DocDefaults struct { RPrDefault *RunProperty PPrDefault *ParagraphProperty }
type Document ¶
type Document struct {
Body *Body `xml:"http://schemas.openxmlformats.org/wordprocessingml/2006/main body"`
}
Document 代表了word整个文档
type Docx ¶
type Docx struct { PackageRelationship *PackageRelationshipItem CoreProperties *CoreProperties CustomProperties *CustomProperties ExtendedProperties *ExtendedProperties ContentTypes *ContentTypes PartRelationship *PartRelationship //FontTable *FontTable //Header *Header //Numbering *Numbering //Settings *Settings Styles *Styles //Footer *Footer Document *Document }
Docx 代表了word整个文档
func OpenDocxFile ¶
type ExtendedProperties ¶
type ExtendedProperties struct { Template string `xml:"Template"` Pages int `xml:"Pages"` Words int `xml:"Words"` Characters int `xml:"Characters"` Lines int `xml:"Lines"` Paragraphs int `xml:"Paragraphs"` TotalTime int `xml:"TotalTime"` ScaleCrop bool `xml:"ScaleCrop"` LinksUpToDate bool `xml:"LinksUpToDate"` CharactersWithSpaces int `xml:"CharactersWithSpaces"` Application string `xml:"Application"` DocSecurity int `xml:"DocSecurity"` }
ExtendedProperties is the `Application-Defined File Properties part` => docProps/app.xml
type Indent ¶
type Indent struct {
// contains filtered or unexported fields
}
Indent 设置段落缩进
This element specifies the set of indentation properties applied to the current paragraph
type Language ¶
type Language struct { // 指定在处理使用拉丁字符的运行内容时(由运行内容的Unicode字符值决定)应用于检查拼写和语法(如果请求)的语言 Value string // 指定在处理使用复杂脚本字符的运行内容时应使用的语言,由运行内容的Unicode字符值决定。 Bidi string // 指定在处理使用东亚字符的运行内容时应使用的语言 EastAsian string }
Language 字体语言
type LatentStyles ¶
type LsdException ¶
type PackageRelationshipItem ¶
type PackageRelationships ¶
type PackageRelationships struct { Xmlns string `xml:"xmlns,attr"` Children []PackageRelationshipItem `xml:"PackageRelationshipItem"` }
PackageRelationships => ./rels/.rels
type Paragraph ¶
type Paragraph struct { Children []ParagraphChild Property *ParagraphProperty HasNumbering bool }
func (*Paragraph) TypeName ¶
func (p *Paragraph) TypeName() BodyChildType
func (*Paragraph) UnmarshalXML ¶
type ParagraphChild ¶
type ParagraphChild interface { String() string TypeName() ParagraphChildType }
type ParagraphChildType ¶
type ParagraphChildType uint8
const ( ParagraphTypeRun ParagraphChildType = iota ParagraphTypePPr )
type ParagraphProperty ¶
type ParagraphProperty struct {
// contains filtered or unexported fields
}
ParagraphProperty 段落属性
func (*ParagraphProperty) Bidi ¶
func (pPr *ParagraphProperty) Bidi() *bool
func (*ParagraphProperty) String ¶
func (pPr *ParagraphProperty) String() string
func (*ParagraphProperty) UnmarshalXML ¶
func (pPr *ParagraphProperty) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
type PartRelationship ¶
type PartRelationship struct { }
type Run ¶
type Run struct { RunProperty *RunProperty Children []RunChild ParentParagraph *Paragraph }
func (*Run) TypeName ¶
func (r *Run) TypeName() ParagraphChildType
func (*Run) UnmarshalXML ¶
UnmarshalXML 解析<w:r>...</w:r>标签下的内容
type RunChild ¶
type RunChild interface { String() string TypeName() RunChildType }
type RunChildType ¶
type RunChildType uint8
const ( RunTypeText RunChildType = iota RunTypeRpr RunTypeBreak )
type RunFonts ¶
type RunFonts struct { // 默认提示所用的子图 Hint string // 处理Ascii字符时所使用的字体 Ascii string // 处理 High ANSI 字符时所使用的字体 HAnsi string // 处理东南亚 East Asian 文字所使用的字体,包括中文 EastAsia string // 处理 Complex Script 字符时所使用的字体 Cs string // Ascii字符所使用的主题 AsciiTheme string // High ANSI字符所使用的主题 HAnsiTheme string // 东南亚文字所使用的主题 EastAsiaTheme string }
RunFonts 最多有4种字体槽
type RunProperty ¶
type RunProperty struct {
// contains filtered or unexported fields
}
RunProperty Run的属性,与 XML 文档对应
This element specifies a set of run properties which shall be applied to the contents of the parentRun run after all style formatting has been applied to the text. These properties are defined as direct formatting, since they are directly applied to the run and supersede any formatting from styles
func (*RunProperty) Bold ¶
func (rPr *RunProperty) Bold() *bool
func (*RunProperty) BoldCs ¶
func (rPr *RunProperty) BoldCs() *bool
func (*RunProperty) Color ¶
func (rPr *RunProperty) Color() *Color
func (*RunProperty) ComplexScript ¶
func (rPr *RunProperty) ComplexScript() *bool
func (*RunProperty) DoubleStrikethrough ¶
func (rPr *RunProperty) DoubleStrikethrough() *bool
func (*RunProperty) EmphasisMark ¶
func (rPr *RunProperty) EmphasisMark() *string
func (*RunProperty) FontKerning ¶
func (rPr *RunProperty) FontKerning() *int
func (*RunProperty) Fonts ¶
func (rPr *RunProperty) Fonts() *RunFonts
func (*RunProperty) Imprint ¶
func (rPr *RunProperty) Imprint() *bool
func (*RunProperty) Italics ¶
func (rPr *RunProperty) Italics() *bool
func (*RunProperty) ItalicsCs ¶
func (rPr *RunProperty) ItalicsCs() *bool
func (*RunProperty) Lang ¶
func (rPr *RunProperty) Lang() *Language
func (*RunProperty) Outline ¶
func (rPr *RunProperty) Outline() *bool
func (*RunProperty) Position ¶
func (rPr *RunProperty) Position() *int
func (*RunProperty) Size ¶
func (rPr *RunProperty) Size() *int
func (*RunProperty) SizeCs ¶
func (rPr *RunProperty) SizeCs() *int
func (*RunProperty) UnmarshalXML ¶
func (rPr *RunProperty) UnmarshalXML(d *xml.Decoder, _ xml.StartElement) error
UnmarshalXML 解析XML文档
type SectionProperty ¶
type SectionProperty struct { }
func (*SectionProperty) String ¶
func (s *SectionProperty) String() string
func (*SectionProperty) TypeName ¶
func (s *SectionProperty) TypeName() BodyChildType
type StyleItem ¶
type StyleItem struct { TypeFor string Default bool //rStyleId string // it has putted into the key of the map Name string QFormat *bool AutoRedefine *bool UiPriority int BasedOn string Next string RPr *RunProperty PPr *ParagraphProperty }
type Styles ¶
type Styles struct { DocDefaults DocDefaults LatentStyles LatentStyles StyleSheets map[string]StyleItem }
func (*Styles) UnmarshalXML ¶
type Table ¶
type Table struct {
Rows []TableRow
}
func (*Table) TypeName ¶
func (p *Table) TypeName() BodyChildType
func (*Table) UnmarshalXML ¶
type TableCell ¶
type TableCell struct { Property TableCellProperty Children []BodyChild }
func (*TableCell) UnmarshalXML ¶
type TableCellProperty ¶
type TableCellProperty struct { // Table Cell Width,如果为小于0的值,则代表未取到该值 Tcw float64 // dxa | pct(百分比) TcwType string }
func (*TableCellProperty) String ¶
func (c *TableCellProperty) String() string
func (*TableCellProperty) UnmarshalXML ¶
func (c *TableCellProperty) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error