docx

package
v0.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2021 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DocumentContentTypeParagraph = DocumentContentType("paragraph")
	DocumentContentTypeTable     = DocumentContentType("table")
)
View Source
const (
	StyleTypeParagraph = StyleType("paragraph")
	StyleTypeCharacter = StyleType("character")
	StyleTypeTable     = StyleType("table")
)

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

func (a *App) GetXmlBytes() ([]byte, error)

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) SetColor

func (b *Background) SetColor(color string) *Background

SetColor 设置颜色

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 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

func (c *Core) GetXmlBytes() ([]byte, error)

GetBody 获取core.xml文件的内容

type Document

type Document struct {
	// contains filtered or unexported fields
}

Document 文档结构定义 该结构统一对.docx格式文档进行操作

func New

func New() (*Document, error)

New 新建一篇文档

func (*Document) AddParagraph

func (d *Document) AddParagraph() *paragraph.Paragraph

AddParagraph 添加一个段落

func (*Document) AddTable

func (d *Document) AddTable() *table.Table

AddTable 添加一个表格

func (*Document) AddTableWithColumns

func (d *Document) AddTableWithColumns(columns int) *table.Table

AddTableWithColumns 添加一个拥有指定列数量的表格

func (*Document) GetBackground

func (d *Document) GetBackground() *Background

GetBackground 获取背景配置结构指针

func (*Document) GetContents

func (d *Document) GetContents() []*DocumentContent

func (*Document) GetProperties

func (d *Document) GetProperties() *StyleConfig

func (*Document) GetSection

func (d *Document) GetSection() *section.Section

GetSection 获取节属性配置结构指针

func (*Document) Save

func (d *Document) Save(path string) error

Save 保存文件到路径 path 为一个完整的包含文件后缀名的路径地址

type DocumentContent

type DocumentContent struct {
	// contains filtered or unexported fields
}

DocumentContent 文档内容

type DocumentContentType

type DocumentContentType string

type Style

type Style struct {
	// contains filtered or unexported fields
}

Style 样式结构

func (*Style) GetXmlBytes

func (s *Style) GetXmlBytes() ([]byte, error)

func (*Style) SetPPr

func (s *Style) SetPPr(pPr *paragraph.PPr) *Style

SetPPr 设置段落样式

func (*Style) SetRPr

func (s *Style) SetRPr(rPr *run.RPr) *Style

SetRPr 设置文本样式

func (*Style) SetStyleId

func (s *Style) SetStyleId(styleId string) *Style

SetStyleId 设置样式ID

func (*Style) SetStyleType

func (s *Style) SetStyleType(styleType StyleType) *Style

SetStyleType 设置样式类型

func (*Style) SetTblPr

func (s *Style) SetTblPr(tblPr *table.TblPr) *Style

SetTblPr 设置表格样式

type StyleConfig

type StyleConfig struct {
	// contains filtered or unexported fields
}

StyleConfig 样式配置结构

func (*StyleConfig) GetDefaultParagraphProperties

func (s *StyleConfig) GetDefaultParagraphProperties() *paragraph.PPr

func (*StyleConfig) GetDefaultRunProperties

func (s *StyleConfig) GetDefaultRunProperties() *run.RPr

func (*StyleConfig) GetXmlBytes

func (s *StyleConfig) GetXmlBytes() ([]byte, error)

type StyleType

type StyleType string

Directories

Path Synopsis
row

Jump to

Keyboard shortcuts

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