internal

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeError  = "e"
	TypeString = "s"
	TypeBool   = "b"
	TypeNumber = "n"
)

Cell type.

Variables

This section is empty.

Functions

This section is empty.

Types

type Book

type Book struct {
	XMLName            xml.Name
	Attrs              []xml.Attr   `xml:",any,attr,omitempty"`
	FileVersion        *Element     `xml:"fileVersion,omitempty"`
	WorkbookPr         *Element     `xml:"workbookPr,omitempty"`
	WorkbookProtection *Element     `xml:"workbookProtection,omitempty"`
	BookViews          *Element     `xml:"bookViews,omitempty"`
	Sheets             []*SheetInfo `xml:"sheets>sheet"`
	DefinedNames       *Element     `xml:"definedNames,omitempty"`
	CalcPr             string       `xml:"calcPr"`
	PivotCaches        *Element     `xml:"pivotCaches,omitempty"`
}

Book represents a workbook.

func (*Book) UnmarshalXML

func (a *Book) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML decodes a single XML element beginning with the given start element.

type CTypes

type CTypes struct {
	XMLName   xml.Name
	Defaults  []*Element `xml:"Default,omitempty"`
	Overrides []Override `xml:"Override,omitempty"`
}

CTypes represents the content types.

type Cell

type Cell struct {
	Attrs   []xml.Attr `xml:",any,attr,omitempty"`
	Ref     string     `xml:"r,attr,omitempty"`
	Style   string     `xml:"s,attr,omitempty"`
	Type    string     `xml:"t,attr,omitempty"`
	Formula *Element   `xml:"f,omitempty"`
	Value   string     `xml:"v,omitempty"`
	Is      *SSI       `xml:"is,omitempty"`
	// contains filtered or unexported fields
}

Cell represents a cell.

func (*Cell) GetStyle

func (a *Cell) GetStyle() string

GetStyle gets the cell style.

func (*Cell) GetValue

func (a *Cell) GetValue() string

GetValue gets the cell value.

func (*Cell) SetStyle

func (a *Cell) SetStyle(s string)

SetStyle sets the cell style.

func (*Cell) SetValue

func (a *Cell) SetValue(t string, v string)

SetValue sets the cell value.

type Col

type Col struct {
	Attrs []xml.Attr `xml:",any,attr,omitempty"`
	Min   int        `xml:"min,attr,omitempty"`
	Max   int        `xml:"max,attr,omitempty"`
}

Col represents a col.

type Cols

type Cols []*Col

Cols represents the cols.

func (Cols) MarshalXML

func (a Cols) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML encodes the receiver as zero or more XML elements.

func (*Cols) UnmarshalXML

func (a *Cols) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML decodes a single XML element beginning with the given start element.

type Dimension

type Dimension struct {
	Ref string `xml:"ref,attr"`
}

Dimension represents a dimension element.

type Element

type Element struct {
	Attrs    []xml.Attr `xml:",any,attr,omitempty"`
	InnerXML []byte     `xml:",innerxml"`
}

Element represents a xml element.

type MergeCell

type MergeCell struct {
	Ref string `xml:"ref,attr"`
}

MergeCell represents a mergeCell element.

type MergeCells

type MergeCells struct {
	Count   int          `xml:"count,attr"`
	Entries []*MergeCell `xml:"mergeCell,omitempty"`
}

MergeCells represents the mergeCell elements.

type Override

type Override struct {
	PartName    string `xml:"PartName,attr"`
	ContentType string `xml:"ContentType,attr"`
}

Override represents the content override.

type Rel

type Rel struct {
	ID     string `xml:"Id,attr"`
	Type   string `xml:"Type,attr"`
	Target string `xml:"Target,attr"`
}

Rel represents represents rel.

type Rels

type Rels struct {
	XMLName xml.Name
	Rels    []Rel `xml:"Relationship"`
}

Rels represents the rels.

func (*Rels) Add

func (a *Rels) Add(typ, target string)

Add adds a new rel to rels.

func (*Rels) Find

func (a *Rels) Find(typ string) string

Find finds the target by type.

func (*Rels) Get

func (a *Rels) Get(id string) string

Get gets the target by id.

type Row

type Row struct {
	Attrs        []xml.Attr `xml:",any,attr,omitempty"`
	Ref          string     `xml:"r,attr,omitempty"`
	CustomHeight string     `xml:"customHeight,attr,omitempty"`
	Spans        string     `xml:"spans,attr,omitempty"`
	Cells        []*Cell    `xml:"c,omitempty"`
}

Row represents a row.

func (*Row) IsBlank added in v0.2.0

func (a *Row) IsBlank() bool

IsBlank checks if the row is blank.

type SSI

type SSI struct {
	Text Text  `xml:"t,omitempty"`
	SSRs []SSR `xml:"r,omitempty"`
}

SSI represents a shared string si element.

func (SSI) String

func (a SSI) String() string

String returns the ssi text.

type SSR

type SSR struct {
	Pr   *Element `xml:"rPr,omitempty"`
	Text Text     `xml:"t"`
}

SSR represents a shared string r element.

type SST

type SST struct {
	XMLName     xml.Name
	Count       int   `xml:"count,attr"`
	UniqueCount int   `xml:"uniqueCount,attr"`
	SSIs        []SSI `xml:"si"`
	// contains filtered or unexported fields
}

SST represents the shared strings.

func NewSST

func NewSST() SST

NewSST creates a new sst.

func (*SST) Delete

func (a *SST) Delete(v string)

Delete deletes the value.

func (*SST) Load

func (a *SST) Load(r string) string

Load loads the string value by r.

func (*SST) MarshalXML

func (a *SST) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML encodes the receiver as zero or more XML elements.

func (*SST) Store

func (a *SST) Store(v string) string

Store stores the value into sst and returns r.

func (*SST) UnmarshalXML

func (a *SST) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML decodes a single XML element beginning with the given start element.

type Sheet

type Sheet struct {
	XMLName         xml.Name
	Attrs           []xml.Attr    `xml:",any,attr,omitempty"`
	SheetPr         *Element      `xml:"sheetPr,omitempty"`
	Dimension       Dimension     `xml:"dimension"`
	SheetViews      *Element      `xml:"sheetViews,omitempty"`
	SheetFormatPr   SheetFormatPr `xml:"sheetFormatPr"`
	Cols            Cols          `xml:"cols,omitempty"`
	Rows            []*Row        `xml:"sheetData>row"`
	SheetProtection *Element      `xml:"sheetProtection,omitempty"`
	AutoFilter      *Element      `xml:"autoFilter,omitempty"`
	MergeCells      *MergeCells   `xml:"mergeCells,omitempty"`
	DataValidations *Element      `xml:"dataValidations,omitempty"`
	Hyperlinks      *Element      `xml:"hyperlinks,omitempty"`
	PrintOptions    *Element      `xml:"printOptions,omitempty"`
	PageMargins     *Element      `xml:"pageMargins,omitempty"`
	PageSetup       *Element      `xml:"pageSetup,omitempty"`
	HeaderFooter    *Element      `xml:"headerFooter,omitempty"`
	Drawing         *Element      `xml:"drawing,omitempty"`
	LegacyDrawing   *Element      `xml:"legacyDrawing,omitempty"`
	TableParts      *Element      `xml:"tableParts,omitempty"`
	// contains filtered or unexported fields
}

Sheet represents the worksheet.

func NewSheet

func NewSheet(sst *SST) *Sheet

NewSheet creates a new sheet.

func (*Sheet) DeleteCols

func (a *Sheet) DeleteCols(j int, n int)

DeleteCols deletes n cols from index j.

func (*Sheet) DeleteRows

func (a *Sheet) DeleteRows(i int, m int)

DeleteRows deletes m rows from index i.

func (*Sheet) ExtendCols

func (a *Sheet) ExtendCols(j int, n int, count int)

ExtendCols extends n cols at index j.

func (*Sheet) ExtendRows

func (a *Sheet) ExtendRows(i int, m int, count int)

ExtendRows extends m rows at index i.

func (*Sheet) Get

func (a *Sheet) Get(i, j int) *Cell

Get gets the cell by index.

func (*Sheet) ICell

func (a *Sheet) ICell(i, j int) *Cell

ICell gets the cell by index.

func (*Sheet) IMerge

func (a *Sheet) IMerge(i, j int, m, n int)

IMerge merges the cells by index.

func (*Sheet) MarshalXML

func (a *Sheet) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML encodes the receiver as zero or more XML elements.

func (*Sheet) Set

func (a *Sheet) Set(i, j int, cell *Cell) *Sheet

Set sets the cell by index.

func (*Sheet) UnmarshalXML

func (a *Sheet) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML decodes a single XML element beginning with the given start element.

type SheetFormatPr

type SheetFormatPr struct {
	Attrs        []xml.Attr `xml:",any,attr,omitempty"`
	CustomHeight string     `xml:"customHeight,attr,omitempty"`
}

SheetFormatPr represents a sheetFormatPr element.

type SheetInfo

type SheetInfo struct {
	Attrs []xml.Attr `xml:",any,attr,omitempty"`
	ID    xml.Attr   `xml:"id,attr"`
	Name  string     `xml:"name,attr"`
}

SheetInfo represents the sheet info.

type Text

type Text string

Text represents a text element.

func (Text) MarshalXML

func (a Text) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML encodes the receiver as zero or more XML elements.

Jump to

Keyboard shortcuts

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