excelutil

package
v0.0.0-...-e311a6d Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultDataStyle

func GetDefaultDataStyle(isBold bool, alignment xlsx.Alignment) *xlsx.Style

func GetDefaultTitleStyle

func GetDefaultTitleStyle(isBold bool, alignment xlsx.Alignment) *xlsx.Style

Types

type Aliment

type Aliment int
const (
	AlimentLeft Aliment = iota + 1
	AlimentRight
	AimentCenter
)

func (Aliment) String

func (a Aliment) String() string

type Cell

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

func NewCell

func NewCell(content string) *Cell

func (*Cell) Bold

func (c *Cell) Bold(isBold bool) *Cell

func (*Cell) HorizontalAlignment

func (c *Cell) HorizontalAlignment(alignment Aliment) *Cell

func (*Cell) WrapText

func (c *Cell) WrapText(wrapText bool) *Cell

type File

type File interface {
	AddSheet(name string, sheetDir SheetDir, titleStyle *xlsx.Style) (Sheet, error)
	ToBytes() ([]byte, error)
}

func NewExcelFile

func NewExcelFile(
	fileName string,
) (File, error)

type Sheet

type Sheet interface {
	SetWidths(widths []uint32)
	AddTitle(titles []*Title)
	AddEntry(cells []*Cell, customStyle *xlsx.Style)
}

type SheetDir

type SheetDir int
const (
	SheetDirTB SheetDir = iota + 1 // top-bottom direction
	SheetDirLR                     // left-right direction
)

type Title

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

func NewCustomTitle

func NewCustomTitle(title string) *Title

func (*Title) Bold

func (t *Title) Bold(isBold bool) *Title

func (*Title) HorizontalAlignment

func (t *Title) HorizontalAlignment(alignment Aliment) *Title

func (*Title) MergeCell

func (t *Title) MergeCell(mergeCellNum uint) *Title

func (*Title) WithBackgroundFill

func (t *Title) WithBackgroundFill(fill *xlsx.Fill) *Title

func (*Title) WrapText

func (t *Title) WrapText(wrapText bool) *Title

type XlsxFile

type XlsxFile struct {
	File     *xlsx.File
	FileName string
}

func (*XlsxFile) AddSheet

func (f *XlsxFile) AddSheet(
	name string, sheetDir SheetDir, titleStyle *xlsx.Style,
) (Sheet, error)

func (*XlsxFile) ToBytes

func (f *XlsxFile) ToBytes() ([]byte, error)

type XlsxSheet

type XlsxSheet struct {
	Sheet     *xlsx.Sheet
	SheetName string
	Direction SheetDir

	TitleStyle *xlsx.Style

	ColCount uint32
	RowCount uint32
}

func (*XlsxSheet) AddEntry

func (s *XlsxSheet) AddEntry(cells []*Cell, customStyle *xlsx.Style)

func (*XlsxSheet) AddTitle

func (s *XlsxSheet) AddTitle(titles []*Title)

func (*XlsxSheet) SetWidths

func (s *XlsxSheet) SetWidths(widths []uint32)

Jump to

Keyboard shortcuts

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