Skip to content

auto adjustement row height #519

@zYasser

Description

@zYasser

hello i have problem when text is too long it will overlap with below row like this

Image

}

func getPageHeader() core.Row {
	return row.New(20).Add(
		image.NewFromFileCol(3, "docs/assets/images/biplane.jpg", props.Rect{
			Center:  true,
			Percent: 80,
		}),
		col.New(5),
		col.New(3).Add(
			text.New("AnyCompany Name Inc. 851 Any Street Name, Suite 120, Any City, CA 45123. ,  120, Any City, CA 45123 120, Any City, CA 45123 120, Any City, CA 45123 120, Any City, CA 45123 120, Any City, CA 45123", props.Text{
				Size:              8,
				Align:             align.Right,
				Color:             getRedColor(),
				BreakLineStrategy: breakline.EmptySpaceStrategy,
			}),
			text.New("Tel: 55 024 12345-1234", props.Text{
				Top:   12,
				Style: fontstyle.BoldItalic,
				Size:  6,
				Align: align.Right,
				Color: getBlueColor(),
			}),
			text.New("www.mycompany.com", props.Text{
				Top:   15,
				Style: fontstyle.BoldItalic,
				Size:  6,
				Align: align.Right,
				Color: getBlueColor(),
			}),
		),
	)
}
func getTransactions(m *core.Maroto) []core.Row {
	rows := []core.Row{
		row.New(5).Add(
			col.New(3),
			text.NewCol(4, "Product", props.Text{Size: 9, Align: align.Center, Style: fontstyle.Bold}),
			text.NewCol(2, "Quantity", props.Text{Size: 9, Align: align.Center, Style: fontstyle.Bold}),
			text.NewCol(3, "Price", props.Text{Size: 9, Align: align.Center, Style: fontstyle.Bold}),
		),
	}


	var contentsRow []core.Row
	contents := getContents()
	/*for i := 0; i < 8; i++ {
	    contents = append(contents, contents...)
	}*/

	for i, content := range contents {

		r := row.New(4).Add(
			col.New(3),
			text.NewCol(4, content[1], props.Text{Size: 8, Align: align.Top, BreakLineStrategy: breakline.EmptySpaceStrategy}),
			text.NewCol(2, content[2], props.Text{Size: 8, Align: align.Center}),
			text.NewCol(3, content[3], props.Text{Size: 8, Align: align.Center}),
		)
		if i%2 == 0 {
			gray := getGrayColor()
			r.WithStyle(&props.Cell{BackgroundColor: gray})
		}

		contentsRow = append(contentsRow, r)
	}

	rows = append(rows, contentsRow...)

	rows = append(rows, row.New(20).Add(
		col.New(7),
		text.NewCol(2, "Total:", props.Text{
			Top:   5,
			Style: fontstyle.Bold,
			Size:  8,
			Align: align.Right,
		}),
		text.NewCol(3, "R$ 2.567,00", props.Text{
			Top:   5,
			Style: fontstyle.Bold,
			Size:  8,
			Align: align.Center,
		}),
	))

	return rows
}

can i make row size dynamic based number of lines ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions