table

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddHTMLOptions

type AddHTMLOptions struct {
	Width float64
}

type Cell

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

func (Cell) Style

func (c Cell) Style(column *Column) *Style

type Column

type Column struct {
	Style *Style
	// contains filtered or unexported fields
}

type PdfHTMLElement

type PdfHTMLElement struct {
	Data     string
	Text     string
	Width    float64
	Height   float64
	OffsetX  float64
	OffsetY  float64
	Style    Style
	Children []*PdfHTMLElement
}

type Row

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

func (*Row) Add

func (r *Row) Add(value any, styles ...*Style)

Add the specified element and style on the row

func (*Row) Draw

func (r *Row) Draw()

Draws the row of the table

func (*Row) Height

func (r *Row) Height() float64

type Style

type Style struct {
	VAlign        string
	Align         string
	Border        string
	Format        string
	Size          float64
	Ln            float64
	Fill          *[]int
	Color         *[]int
	PaddingTop    float64
	PaddingRight  float64
	PaddingBottom float64
	PaddingLeft   float64
	MarginTop     float64
	MarginRight   float64
	MarginBottom  float64
	MarginLeft    float64
	// contains filtered or unexported fields
}

func (*Style) Assign

func (s *Style) Assign(styles ...*Style) *Style

Assign multiple styles (basically, it picks the one initialized and NOT at the empty value)

func (*Style) Clone

func (s *Style) Clone() *Style

Clone the specified style

func (*Style) Inherit

func (s *Style) Inherit() *Style

func (*Style) Margin

func (s *Style) Margin(margin ...float64) *Style

func (*Style) Padding

func (s *Style) Padding(padding ...float64) *Style

type Table

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

func New

func New(p *gofpdf.Fpdf, x1 float64, x2 float64) *Table

func (*Table) AcceptPageBreak

func (t *Table) AcceptPageBreak() map[string]func() bool

Calls the tablePageBreak method of the table if exists by default it keeps printing the table in a new page

func (*Table) Add

func (t *Table) Add(value any, styles ...*Style) *Table

Add the specified value and style

func (*Table) AddHTML

func (t *Table) AddHTML(htmlStr string, styles ...*Style) *Table

func (*Table) AddImage

func (t *Table) AddImage(imageNameStr string) *Table

func (*Table) AddInline

func (t *Table) AddInline(value any, styles ...*Style) *Table

AddInline adds the value without changing the Y

func (*Table) AddMany

func (t *Table) AddMany(values ...any) *Table

AddMany adds multiple columns to the table

func (*Table) AddNext

func (t *Table) AddNext(value any, styles ...*Style) *Table

Add the specified value, style and skips to the next column if there is one otherwise it skips to the next row

func (*Table) Close

func (t *Table) Close() *Table

Prints the table

func (*Table) Col

func (t *Table) Col(index int) *Column

Col returns the column by index; returns nil if the column is not found

func (*Table) ColumnBoundaries

func (t *Table) ColumnBoundaries(colIndex ...int) (x1 float64, x2 float64)

func (*Table) ColumnSize

func (t *Table) ColumnSize(colIndex ...int) float64

func (*Table) Columns

func (t *Table) Columns() *[]Column

Columns returns the columns of the table

func (*Table) DrawBorder

func (t *Table) DrawBorder(borderStr string, x, y, w, h float64)

func (*Table) Footers

func (t *Table) Footers() map[string]func(*gofpdf.Fpdf)

func (*Table) Headers

func (t *Table) Headers() map[string]func(*gofpdf.Fpdf)

Calls the tableHeader method if exists

func (*Table) Hr

func (t *Table) Hr() *Table

Hr will draw an horizontal line at the bottom of the current row's next Draw call

func (*Table) Next

func (t *Table) Next() *Table

Skips to the next column if there is one otherwise it skips to the next row

func (*Table) NextRow

func (t *Table) NextRow() *Table

Prints the current table and then draws a new row

func (*Table) RowHeight

func (t *Table) RowHeight() float64

func (*Table) SetFooterFunc

func (t *Table) SetFooterFunc(footerFunc func()) *Table

Used for setting the footerFunc method

func (*Table) SetHeaderFunc

func (t *Table) SetHeaderFunc(headerFunc func()) *Table

Used for setting the headerFunc method

func (*Table) SetRowHeight

func (t *Table) SetRowHeight(rowHeight float64) *Table

Sets the desired row height for the next rows.

Set it to 0 to reset to dynamic height.

func (*Table) SetSizes

func (t *Table) SetSizes(sizes ...float64) *Table

SetSizes overrides the current column sizes with the provided ones It also initializes the styles array with the columns' size This method resets columnIndex and rowHeight to 0 when called

func (*Table) SetStyle

func (t *Table) SetStyle(style *Style) *Table

SetStyle sets the provided style for all columns

func (*Table) SetStyles

func (t *Table) SetStyles(styles ...*Style) *Table

Sets the style of the different columns

Jump to

Keyboard shortcuts

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