sheet

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: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RelationShipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"
	ContentType      = "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Col

type Col struct {
	Name xml.Name `xml:"col"`

	CustomWidth bool    `xml:"customWidth,attr"`
	Hidden      bool    `xml:"hidden,attr"`
	Min         uint    `xml:"min,attr"`
	Max         uint    `xml:"max,attr"`
	Style       uint    `xml:"s,attr"`
	Width       float32 `xml:"width,attr"`
}

type Cols

type Cols struct {
	Name xml.Name `xml:"cols"`

	Cols []*Col
}

type Data

type Data struct {
	XMLName xml.Name `xml:"sheetData"`

	Rows []*row.Row `xml:"row"`
	// contains filtered or unexported fields
}

func (*Data) MarshalXML

func (d *Data) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Data) SetCellWithNumber

func (d *Data) SetCellWithNumber(ri, ci uint64, number interface{}) *Data

SetCellWithNumber 设置单元格并将单元格内容设置为数字类型(整形与浮点型)

func (*Data) SetCellWithText

func (d *Data) SetCellWithText(ri, ci uint64, text string) *Data

SetCellWithText 设置多行文本 TODO 需要实现SharedStringTable

func (*Data) SetCellWithValue

func (d *Data) SetCellWithValue(ri, ci uint64, value interface{}) *Data

SetCellWithValue 设置单元格并将单元格内容设置为行内字符串 设置多行字符串请使用 SetCellWithText 方法

type FormatProperty

type FormatProperty struct {
	XMLName xml.Name `xml:"sheetFormatPr"`

	BaseColWidth     int `xml:"baseColWidth,attr,omitempty"`
	DefaultColWidth  int `xml:"defaultColWidth,attr,omitempty"`
	DefaultRowHeight int `xml:"defaultRowHeight,attr,omitempty"`
}

type MergeCell

type MergeCell struct {
	Name xml.Name `xml:"mergeCell"`

	Reference string `xml:"ref,attr"`
}

type MergeCells

type MergeCells struct {
	Name xml.Name `xml:"mergeCells"`

	MergeCells []*MergeCell
}

type Sheet

type Sheet struct {
	XMLName xml.Name `xml:"worksheet"`

	RootNamespace string `xml:"xmlns,attr"`

	Views  *Views
	Format *FormatProperty
	Data   *Data
	Cols   *Cols
	// contains filtered or unexported fields
}

Sheet 工作表定义

func NewSheet

func NewSheet(id, name, rId string) *Sheet

func (*Sheet) Filepath

func (s *Sheet) Filepath() string

func (*Sheet) Id

func (s *Sheet) Id() string

func (*Sheet) Marshal

func (s *Sheet) Marshal() ([]byte, error)

func (*Sheet) Name

func (s *Sheet) Name() string

func (*Sheet) RelationshipId

func (s *Sheet) RelationshipId() string

func (*Sheet) SetBaseColWidth

func (s *Sheet) SetBaseColWidth(num int) *Sheet

func (*Sheet) SetCellWithNumber

func (s *Sheet) SetCellWithNumber(ri, ci uint64, number interface{}) *Sheet

func (*Sheet) SetCellWithText

func (s *Sheet) SetCellWithText(ri, ci uint64, text string) *Sheet

func (*Sheet) SetCellWithValue

func (s *Sheet) SetCellWithValue(ri, ci uint64, value interface{}) *Sheet

func (*Sheet) SetDefaultColWidth

func (s *Sheet) SetDefaultColWidth(width int) *Sheet

func (*Sheet) SetDefaultRowHeight

func (s *Sheet) SetDefaultRowHeight(height int) *Sheet

func (*Sheet) SetName

func (s *Sheet) SetName(name string) *Sheet

SetName 设置数据表名

type View

type View struct {
	XMLName xml.Name `xml:"sheetView"`

	TabSelected    int `xml:"tabSelected,attr"`
	WorkbookViewId int `xml:"workbookViewId,attr"`
}

type Views

type Views struct {
	XMLName xml.Name `xml:"sheetViews"`

	Views []View
	// contains filtered or unexported fields
}

func (*Views) AddView

func (s *Views) AddView(view View) *Views

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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