book

package
v0.9.17 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const MetasheetName = "@TABLEAU"

MetasheetName defines the meta data of each worksheet.

Variables

This section is empty.

Functions

func ExtendSheet

func ExtendSheet(sheet *Sheet, rows [][]string)

ExtendSheet extends an existing Sheet.

func ExtractFromCell

func ExtractFromCell(cell string, line int32) string

func MetasheetOptions added in v0.9.12

func MetasheetOptions() *tableaupb.WorksheetOptions

Types

type Book

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

func NewBook

func NewBook(bookName, filename string, parser SheetParser) *Book

func (*Book) AddSheet

func (b *Book) AddSheet(sheet *Sheet)

AddSheet adds a sheet to the book and keep the sheet order.

func (*Book) BookName

func (b *Book) BookName() string

BookNames returns this book's name.

func (*Book) Clear added in v0.9.8

func (b *Book) Clear()

Clear clears all sheets in the book.

func (*Book) DelSheet

func (b *Book) DelSheet(sheetName string)

DelSheet deletes a sheet from the book.

func (*Book) ExportCSV

func (b *Book) ExportCSV() error

func (*Book) ExportExcel

func (b *Book) ExportExcel() error

func (*Book) Filename

func (b *Book) Filename() string

Filename returns this book's original filename.

func (*Book) GetSheet

func (b *Book) GetSheet(name string) *Sheet

GetSheet returns a Sheet of the specified sheet name.

func (*Book) GetSheets

func (b *Book) GetSheets() []*Sheet

GetSheets returns all sheets in order in the book.

func (*Book) ParseMeta

func (b *Book) ParseMeta() error

func (*Book) Squeeze

func (b *Book) Squeeze(sheetNames []string)

Squeeze keeps only the inputed sheet names and removes other sheets from the book.

type RowCell

type RowCell struct {
	Col  int    // cell column (0-based)
	Data string // cell data
	Type string // cell type
	Name string // cell name
	// contains filtered or unexported fields
}

type RowCells

type RowCells struct {
	Row int // row number
	// contains filtered or unexported fields
}

func NewRowCells

func NewRowCells(row int, prev *RowCells) *RowCells

func (*RowCells) Cell

func (r *RowCells) Cell(name string, optional bool) *RowCell

func (*RowCells) CellDebugString

func (r *RowCells) CellDebugString(name string) string

func (*RowCells) GetCellCountWithPrefix

func (r *RowCells) GetCellCountWithPrefix(prefix string) int

func (*RowCells) SetCell

func (r *RowCells) SetCell(name string, col int, data, typ string, needPopulateKey bool)

type Sheet

type Sheet struct {
	Name   string
	MaxRow int
	MaxCol int

	Rows [][]string // 2D array of string.

	Meta *tableaupb.SheetMeta
}

func NewSheet

func NewSheet(name string, rows [][]string) *Sheet

NewSheet creats a new Sheet.

func (*Sheet) Cell

func (s *Sheet) Cell(row, col int) (string, error)

Cell returns the cell at (row, col).

func (*Sheet) ExportCSV

func (s *Sheet) ExportCSV(writer io.Writer) error

func (*Sheet) ExportExcel

func (s *Sheet) ExportExcel(file *excelize.File) error

func (*Sheet) String

func (s *Sheet) String() string

String returns the string representation (CSV) of the sheet.

type SheetParser

type SheetParser interface {
	Parse(protomsg proto.Message, sheet *Sheet) error
}

Jump to

Keyboard shortcuts

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