Documentation
¶
Overview ¶
Package row implements creation of rows.
Index ¶
- func New(height ...float64) core.Row
- type Row
- func (r *Row) Add(cols ...core.Col) core.Row
- func (r *Row) GetColumns() []core.Col
- func (r *Row) GetHeight(provider core.Provider, cell *entity.Cell) float64
- func (r *Row) GetStructure() *node.Node[core.Structure]
- func (r *Row) Render(provider core.Provider, cell entity.Cell)
- func (r *Row) SetConfig(config *entity.Config)
- func (r *Row) WithStyle(style *props.Cell) core.Row
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
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.
package main
import (
"github.com/flanksource/maroto/v2"
"github.com/flanksource/maroto/v2/pkg/components/row"
)
func main() {
// 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 ¶
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.
package main
import (
"github.com/flanksource/maroto/v2"
"github.com/flanksource/maroto/v2/pkg/components/code"
"github.com/flanksource/maroto/v2/pkg/components/row"
"github.com/flanksource/maroto/v2/pkg/components/signature"
"github.com/flanksource/maroto/v2/pkg/components/text"
)
func main() {
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 ¶
GetColumns returns the columns of a core.Row.
func (*Row) GetStructure ¶
GetStructure returns the Structure of a core.Row.
func (*Row) WithStyle ¶
WithStyle sets the style of a Row.
Example ¶
ExampleRow_WithStyle demonstrates how to add style to Row.
package main
import (
"github.com/flanksource/maroto/v2"
"github.com/flanksource/maroto/v2/pkg/components/row"
"github.com/flanksource/maroto/v2/pkg/consts/border"
"github.com/flanksource/maroto/v2/pkg/consts/linestyle"
"github.com/flanksource/maroto/v2/pkg/props"
)
func main() {
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:
Click to show internal directories.
Click to hide internal directories.