xlsx

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertHTMLToRichText

func ConvertHTMLToRichText(html string) string

ConvertHTMLToRichText converts basic HTML to Excel rich text format Supports: <b>, <i>, <u>, <span style="color:...">

Types

type Cell

type Cell struct {
	Ref   string        `xml:"r,attr,omitempty"`
	Type  string        `xml:"t,attr,omitempty"`
	Value string        `xml:"v,omitempty"`
	IS    *InlineString `xml:"is,omitempty"`
}

Cell represents a cell in Excel

type CellStyle

type CellStyle struct {
	BackgroundColor string // Hex color like "FFFF00" for yellow
	FontColor       string // Hex color like "FF0000" for red
	FontSize        int    // Font size in points
	Bold            bool
	Border          bool // Simple border on/off
}

CellStyle represents formatting options for a cell

type InlineString

type InlineString struct {
	T string `xml:"t"`
}

InlineString for text cells

type Row

type Row struct {
	XMLNode xml.Name
	Cells   []Cell
}

Row represents a row with dynamic data for loops

type Sheet

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

Sheet represents a worksheet in the XLSX file

type Template

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

Template represents an XLSX document template

func Open

func Open(path string) (*Template, error)

Open reads an XLSX file and prepares it for manipulation

func (*Template) Apply

func (t *Template) Apply(data map[string]any) error

Apply replaces multiple placeholders

func (*Template) Close

func (t *Template) Close() error

Close releases resources

func (*Template) ProcessLoops

func (t *Template) ProcessLoops(data map[string]any) error

ProcessLoops handles {#arrayName}...{/arrayName} in rows

func (*Template) Save

func (t *Template) Save(path string) error

Save writes the modified XLSX file

func (*Template) SetCellValue

func (t *Template) SetCellValue(placeholder, value string) error

SetCellValue replaces a placeholder in cells with a value

func (*Template) SetCellValueHTML

func (t *Template) SetCellValueHTML(placeholder, htmlValue string) error

SetCellValueHTML replaces a placeholder with HTML content (basic support)

Jump to

Keyboard shortcuts

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