xl

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlobHash

func BlobHash(blob []byte) uuid.UUID

func CellCoordAsString

func CellCoordAsString(col, row int) string

func ColumnNumberAsLetters

func ColumnNumberAsLetters(n int) string

Types

type Cell

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

func (*Cell) SetBool

func (c *Cell) SetBool(v bool)

func (*Cell) SetFloat

func (c *Cell) SetFloat(v float64)

func (*Cell) SetInt

func (c *Cell) SetInt(v int64)

func (*Cell) SetPicture

func (c *Cell) SetPicture(p *PictureInfo)

func (*Cell) SetStr

func (c *Cell) SetStr(v string)

type CellType

type CellType int

CellType is the type of cell value type.

const (
	CellTypeUnset CellType = iota
	CellTypeBool
	CellTypeDate
	CellTypeError
	CellTypeFormula
	CellTypeInlineString
	CellTypeNumber
	CellTypeSharedString
)

Cell value types enumeration.

type Column added in v0.1.1

type Column struct {
	Width float32
}

type DirStorage

type DirStorage struct {
	Dir string
}

func NewDirStorage

func NewDirStorage(dir string) *DirStorage

func (*DirStorage) WriteBlob

func (ds *DirStorage) WriteBlob(path string, blob []byte) error

type MediaInfo

type MediaInfo struct {
	Name string // hashed blob + extension
	Blob []byte
	IId  int
	RId  string
}

type PictureInfo

type PictureInfo struct {
	Extension string
	Blob      []byte
}

type RelInfo

type RelInfo struct {
	Type   string // url to schema type
	Target string // relative path
}

type Row

type Row struct {
	Cells []*Cell

	Height float32 // when Height=0, use default ~30?
	// contains filtered or unexported fields
}

func (*Row) AddCell

func (r *Row) AddCell() *Cell

type Sheet

type Sheet struct {
	Name    string
	Rows    []*Row
	Columns map[int]*Column // 1-based
	// contains filtered or unexported fields
}

func (*Sheet) AddRow

func (s *Sheet) AddRow() *Row

func (*Sheet) SetColumnWidth added in v0.1.1

func (s *Sheet) SetColumnWidth(colNumber int, w float32)

type Storage

type Storage interface {
	WriteBlob(path string, blob []byte) error
}

type Workbook

type Workbook struct {
	AppName string
	Sheets  []*Sheet
	// contains filtered or unexported fields
}

func NewWorkbook

func NewWorkbook() *Workbook

func (*Workbook) AddSheet

func (wb *Workbook) AddSheet(name string) (*Sheet, error)

type Writer

type Writer struct {
	GlobalRels          map[string]RelInfo // maps id to absolute path
	WorkbookRels        map[string]RelInfo // maps id to absolute paths
	DefaultContentTypes map[string]string  // maps path extension to content-type
	PartContentTypes    map[string]string  // maps path partname to content-type

	RichDataRels map[string]RelInfo
	// contains filtered or unexported fields
}

func NewWriter

func NewWriter(s Storage) *Writer

func (*Writer) SharedString

func (w *Writer) SharedString(s string) int

func (*Writer) Write

func (w *Writer) Write(wb *Workbook) error

type ZipStorage

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

func NewZipStorage

func NewZipStorage(out io.Writer) *ZipStorage

func (*ZipStorage) Close

func (zs *ZipStorage) Close()

func (*ZipStorage) WriteBlob

func (zs *ZipStorage) WriteBlob(path string, blob []byte) error

Jump to

Keyboard shortcuts

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