table

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package table implements a PDF table component with colspan, rowspan, and per-cell styling.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTableSpanOverlap is returned when colspan/rowspan cells overlap each other.
	ErrTableSpanOverlap = errors.New("table: cell spans overlap")
	// ErrTableEmpty is returned when the cell matrix is empty.
	ErrTableEmpty = errors.New("table: empty cell matrix")
)

Functions

This section is empty.

Types

type Cell

type Cell struct {
	Content core.Component
	Colspan int
	Rowspan int
	Style   *props.Cell
}

Cell is one entry in the table grid.

type Option

type Option func(*Table)

Option configures a Table.

func WithColumnWidths

func WithColumnWidths(widths []float64) Option

WithColumnWidths configures relative column widths. Values are normalized to fractions that sum to 1. Non-positive or missing values fall back to the average explicit width so partially specified tables remain usable.

type Table

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

Table is a core.Component that renders a grid with span support.

func New

func New(cells [][]Cell, opts ...Option) (*Table, error)

New validates spans, normalises the grid, and builds the Table component.

func (*Table) ColCount

func (t *Table) ColCount() int

ColCount returns the number of columns determined from the normalised grid.

func (*Table) ColumnWidths

func (t *Table) ColumnWidths() []float64

ColumnWidths returns normalized column width fractions, or nil for equal widths.

func (*Table) GetHeight

func (t *Table) GetHeight(provider core.Provider, cell *entity.Cell) float64

GetHeight computes and returns the total table height.

func (*Table) GetStructure

func (t *Table) GetStructure() *node.Node[core.Structure]

GetStructure returns the component node for snapshots/debugging.

func (*Table) Render

func (t *Table) Render(provider core.Provider, cell *entity.Cell)

Render draws the table into the PDF cell.

func (*Table) SetConfig

func (t *Table) SetConfig(config *entity.Config)

SetConfig propagates Paper config to all cell components.

Jump to

Keyboard shortcuts

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