xlsx

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"
	AppContentType      = "application/vnd.openxmlformats-officedocument.extended-properties+xml"
)
View Source
const (
	CoreRelationshipType = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"
	CoreContentType      = "application/vnd.openxmlformats-package.core-properties+xml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentType

type ContentType struct {
	XMLName xml.Name `xml:"Types"`

	RootNamespace string `xml:"xmlns,attr"`

	Defaults []Default

	Overrides []Override
	// contains filtered or unexported fields
}

func NewContentType

func NewContentType() *ContentType

func (*ContentType) AddDefault

func (c *ContentType) AddDefault(d Default) *ContentType

func (*ContentType) AddOverride

func (c *ContentType) AddOverride(o Override) *ContentType

func (*ContentType) Filepath

func (c *ContentType) Filepath() string

func (*ContentType) Marshal

func (c *ContentType) Marshal() ([]byte, error)

type Default

type Default struct {
	XMLName xml.Name `xml:"Default"`

	Extension string `xml:"Extension,attr"`

	ContentType string `xml:"ContentType,attr"`
}

type DocPropsApp

type DocPropsApp struct {
	XMLName xml.Name `xml:"Properties"`

	RootNamespace string `xml:"xmlns,attr"`

	Application string `xml:"Application"`
	DocSecurity int    `xml:"DocSecurity"`
	AppVersion  string `xml:"AppVersion"`
}

func NewDocPropsApp

func NewDocPropsApp() *DocPropsApp

func (*DocPropsApp) Filepath

func (d *DocPropsApp) Filepath() string

func (*DocPropsApp) Marshal

func (d *DocPropsApp) Marshal() ([]byte, error)

type DocPropsCore

type DocPropsCore struct {
	XMLName xml.Name `xml:"cp:coreProperties"`

	CpNamespace  string `xml:"xmlns:cp,attr"`
	DcNamespace  string `xml:"xmlns:dc,attr"`
	DctNamespace string `xml:"xmlns:dcterms,attr"`
	XsiNamespace string `xml:"xmlns:xsi,attr"`

	Creator    string `xml:"dc:creator"`
	LastModify string `xml:"cp:lastModifiedBy"`
	Created    DocPropsCoreCreated
	Modified   DocPropsCoreModified
}

func NewDocPropsCore

func NewDocPropsCore() *DocPropsCore

func (*DocPropsCore) Filepath

func (d *DocPropsCore) Filepath() string

func (*DocPropsCore) Marshal

func (d *DocPropsCore) Marshal() ([]byte, error)

func (*DocPropsCore) SetTime

func (d *DocPropsCore) SetTime(t time.Time) *DocPropsCore

func (*DocPropsCore) SetUsername

func (d *DocPropsCore) SetUsername(user string) *DocPropsCore

type DocPropsCoreCreated

type DocPropsCoreCreated struct {
	XMLName xml.Name `xml:"dcterms:created"`

	Type string `xml:"xsi:type,attr"`

	Created string `xml:",innerxml"`
}

type DocPropsCoreModified

type DocPropsCoreModified struct {
	XMLName xml.Name `xml:"dcterms:modified"`

	Type string `xml:"xsi:type,attr"`

	Created string `xml:",innerxml"`
}

type Document

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

Document xlsx文档

func New

func New() (*Document, error)

New 新建一个xlsx文档

func (*Document) GetWorkbook

func (d *Document) GetWorkbook() *workbook.Workbook

func (*Document) NewSheet

func (d *Document) NewSheet() *sheet.Sheet

NewSheet 代理 Workbook.NewSheet 方法

func (*Document) NewSheetWithName

func (d *Document) NewSheetWithName(name string) *sheet.Sheet

NewSheetWithName 代理 Workbook.NewSheetWithName 方法

func (*Document) Save

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

func (*Document) SetDocumentUser

func (d *Document) SetDocumentUser(user string) *Document

type Override

type Override struct {
	XMLName xml.Name `xml:"Override"`

	// PartName 单元名称
	PartName string `xml:"PartName,attr"`

	// ContentType Type类型
	ContentType string `xml:"ContentType,attr"`
}

Override Override结构定义

type Relationship

type Relationship struct {
	XMLName xml.Name `xml:"Relationship"`

	// Id 关联的id
	Id string `xml:"Id,attr"`

	// Type 关联类型
	Type string `xml:"Type,attr"`

	// Target 目标位置
	Target string `xml:"Target,attr"`
}

Relationship 关联结构定义

type RootRelationship

type RootRelationship struct {
	XMLName xml.Name `xml:"Relationships"`

	RootNamespace string `xml:"xmlns,attr"`

	Relationships []Relationship
	// contains filtered or unexported fields
}

func NewRootRelationship

func NewRootRelationship() *RootRelationship

func (*RootRelationship) AddRelationship

func (r *RootRelationship) AddRelationship(rel Relationship) *RootRelationship

func (*RootRelationship) Filepath

func (r *RootRelationship) Filepath() string

func (*RootRelationship) Marshal

func (r *RootRelationship) Marshal() ([]byte, error)

func (*RootRelationship) NextRId

func (r *RootRelationship) NextRId() string

type XmlEntry

type XmlEntry interface {
	// Marshal 序列化文件的xml内容
	Marshal() ([]byte, error)
}

type XmlFile

type XmlFile interface {
	XmlEntry

	// Filepath 返回文件路径
	Filepath() string
}

XmlFile xml文件结构接口

Directories

Path Synopsis
row

Jump to

Keyboard shortcuts

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