row

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 4 Imported by: 18

Documentation

Overview

Package row implements creation of rows.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(height ...float64) core.Row

New is responsible to create a core.Row.

Height is an optional parameter that, if not sent, will be calculated automatically Height is defined in mm.

Example

ExampleNew demonstrates how to create a Row instance.

// height defines the size of the useful area
// which can be used in the set of columns and components
// inside this row.
height := 10.0
row := row.New(height)

m := maroto.New()

m.AddRows(row)

// Do things and generate
_, _ = m.Generate()
Output:

Types

type Row

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

func (*Row) Add

func (r *Row) Add(cols ...core.Col) core.Row

Add is responsible to add one or more core.Col to a core.Row.

Example

ExampleRow_Add demonstrates how to add cols inside a Row.

textCol := text.NewCol(12, "text content")
qrCodeCol := code.NewQrCol(12, "qrcode")
signatureCol := signature.NewCol(12, "signature label")

row := row.New(10).Add(textCol, qrCodeCol, signatureCol)

m := maroto.New()
m.AddRows(row)

// Do things and generate
_, _ = m.Generate()
Output:

func (*Row) GetColumns

func (r *Row) GetColumns() []core.Col

GetColumns returns the columns of a core.Row.

func (*Row) GetHeight

func (r *Row) GetHeight(provider core.Provider, cell *entity.Cell) float64

GetHeight returns the height of a core.Row.

func (*Row) GetStructure

func (r *Row) GetStructure() *node.Node[core.Structure]

GetStructure returns the Structure of a core.Row.

func (*Row) Render

func (r *Row) Render(provider core.Provider, cell entity.Cell)

Render renders a Row into a PDF context.

func (*Row) SetConfig

func (r *Row) SetConfig(config *entity.Config)

SetConfig sets the Row configuration.

func (*Row) WithStyle

func (r *Row) WithStyle(style *props.Cell) core.Row

WithStyle sets the style of a Row.

Example

ExampleRow_WithStyle demonstrates how to add style to Row.

row := row.New(10)

row.WithStyle(&props.Cell{
	BackgroundColor: &props.Color{
		Red:   10,
		Green: 100,
		Blue:  150,
	},
	BorderColor: &props.Color{
		Red:   55,
		Green: 10,
		Blue:  60,
	},
	BorderType:      border.Full,
	BorderThickness: 0.1,
	LineStyle:       linestyle.Dashed,
})

m := maroto.New()
m.AddRows(row)

// Do things and generate
_, _ = m.Generate()
Output:

Jump to

Keyboard shortcuts

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