Documentation
¶
Index ¶
- Constants
- type App
- type Background
- func (b *Background) GetXmlBytes() ([]byte, error)
- func (b *Background) SetBackground(color, themeColor, themeShade, themeTint string) *Background
- func (b *Background) SetColor(color string) *Background
- func (b *Background) SetThemeColor(themeColor string) *Background
- func (b *Background) SetThemeShade(themeShade string) *Background
- func (b *Background) SetThemeTint(themeTint string) *Background
- type ContentTypeType
- type ContentTypes
- type Core
- type Document
- func (d *Document) AddParagraph() *paragraph.Paragraph
- func (d *Document) AddTable() *table.Table
- func (d *Document) AddTableWithColumns(columns int) *table.Table
- func (d *Document) AddTableWithColumnsAndAutoWidth(columns int) *table.Table
- func (d *Document) GetBackground() *Background
- func (d *Document) GetContents() []*DocumentContent
- func (d *Document) GetFooters() []*footer.Footer
- func (d *Document) GetHeaders() []*header.Header
- func (d *Document) GetProperties() *Styles
- func (d *Document) GetSection() *section.Section
- func (d *Document) NewFooter() *footer.Footer
- func (d *Document) NewHeader() *header.Header
- func (d *Document) Save(path string) error
- func (d *Document) SetDocumentUser(username string) *Document
- func (d *Document) UseFooter(footerType FooterType, ftr *footer.Footer) *Document
- func (d *Document) UseHeader(headerType HeaderType, hdr *header.Header) *Document
- type DocumentContent
- type DocumentContentType
- type FooterType
- type HeaderType
- type Relationship
- type RelationshipType
- type Relationships
- type Style
- type StyleType
- type Styles
Constants ¶
const ( ContentTypeTypeMain = ContentTypeType("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml") ContentTypeTypeStyle = ContentTypeType("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml") ContentTypeTypeCore = ContentTypeType("application/vnd.openxmlformats-package.core-properties+xml") ContentTypeTypeApp = ContentTypeType("application/vnd.openxmlformats-officedocument.extended-properties+xml") ContentTypeTypeHeader = ContentTypeType("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml") )
const ( DocumentContentTypeParagraph = DocumentContentType("paragraph") DocumentContentTypeTable = DocumentContentType("table") )
const ()
const ( HeaderTypeFirst = HeaderType("first") HeaderTypeEven = HeaderType("even") HeaderTypeDefault = HeaderType("default") )
const ( RelationshipTypeStyle = RelationshipType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles") RelationshipTypeSetting = RelationshipType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings") RelationshipTypeFontTable = RelationshipType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable") RelationshipTypeHeader = RelationshipType("http://schemas.openxmlformats.org/officeDocument/2006/relationships/header") )
const ( StyleTypeParagraph = StyleType("paragraph") StyleTypeCharacter = StyleType("character") StyleTypeTable = StyleType("table") )
const DocumentDefaultHeight = 16838
DocumentDefaultHeight 文档默认高度
const DocumentDefaultWidth = 11906
DocumentDefaultWidth 文档默认宽度
const TableDefaultWidth = 8800
TableDefaultWidth 表格默认宽度
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct { // Template 模板名称 Template string // Application 生产者应用的名称 Application string // Security 加密级别 Security int }
App app.xml
func (*App) GetXmlBytes ¶
type Background ¶
type Background struct {
// contains filtered or unexported fields
}
themeTint 文档的背景配置
func (*Background) GetXmlBytes ¶
func (b *Background) GetXmlBytes() ([]byte, error)
func (*Background) SetBackground ¶
func (b *Background) SetBackground(color, themeColor, themeShade, themeTint string) *Background
SetBackground 设置文档背景
func (*Background) SetThemeColor ¶
func (b *Background) SetThemeColor(themeColor string) *Background
SetThemeColor 设置主题颜色
func (*Background) SetThemeShade ¶
func (b *Background) SetThemeShade(themeShade string) *Background
SetThemeShade 设置主题阴影
func (*Background) SetThemeTint ¶
func (b *Background) SetThemeTint(themeTint string) *Background
SetThemeTint 设置主题的色调值 0-255的16进制字符串
type ContentTypeType ¶
type ContentTypeType string
type ContentTypes ¶
type ContentTypes struct {
// contains filtered or unexported fields
}
ContentTypes [Content_Types].xml
func (*ContentTypes) AddContentType ¶
func (c *ContentTypes) AddContentType(path string, ct ContentTypeType) *ContentTypes
func (*ContentTypes) GetXmlBytes ¶
func (c *ContentTypes) GetXmlBytes() ([]byte, error)
type Core ¶
type Core struct { // CreateUser 创建文档的用户名称 CreateUser string // CreateTime 文档的创建时间 CreateTime time.Time // LastModifyUser 最后修改的用户名 LastModifyUser string // LastModifyTime 最后修改的时间 LastModifyTime time.Time // Version 版本号,每修改一次+1 Version int }
Core core.xml
func (*Core) GetXmlBytes ¶
GetXmlBytes GetBody 获取core.xml文件的内容
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
Document 文档结构定义 该结构统一对.docx格式文档进行操作
func (*Document) AddParagraph ¶
AddParagraph 添加一个段落
func (*Document) AddTableWithColumns ¶
AddTableWithColumns 添加一个拥有指定列数量的表格
func (*Document) AddTableWithColumnsAndAutoWidth ¶
AddTableWithColumnsAndAutoWidth 添加一个拥有指定列数量的表格,并且自动计算所有列的宽度
func (*Document) GetBackground ¶
func (d *Document) GetBackground() *Background
GetBackground 获取背景配置结构指针
func (*Document) GetContents ¶
func (d *Document) GetContents() []*DocumentContent
func (*Document) GetFooters ¶
func (*Document) GetHeaders ¶
func (*Document) GetProperties ¶
func (*Document) GetSection ¶
GetSection 获取节属性配置结构指针
func (*Document) SetDocumentUser ¶
SetDocumentUser 设置文档的创建与修改用户
type DocumentContent ¶
type DocumentContent struct {
// contains filtered or unexported fields
}
DocumentContent 文档内容
type DocumentContentType ¶
type DocumentContentType string
type FooterType ¶
type FooterType string
type HeaderType ¶
type HeaderType string
type Relationship ¶
type Relationship struct {
// contains filtered or unexported fields
}
Relationship 关联定义
type RelationshipType ¶
type RelationshipType string
type Relationships ¶
type Relationships struct {
// contains filtered or unexported fields
}
Relationships 文档关联定义
func (*Relationships) AddRelationship ¶
func (r *Relationships) AddRelationship(target string, relationshipType RelationshipType) string
AddRelationship 添加一个关联定义
func (*Relationships) GetXmlBytes ¶
func (r *Relationships) GetXmlBytes() ([]byte, error)
type Style ¶
type Style struct {
// contains filtered or unexported fields
}
Style 样式结构
func (*Style) GetXmlBytes ¶
func (*Style) SetStyleType ¶
SetStyleType 设置样式类型
type Styles ¶
type Styles struct {
// contains filtered or unexported fields
}
Styles 样式配置结构