class HexaPDF::Layout::TableBox::Cell

Parent

Represents a single cell of the table.

A cell is a container box that fits and draws its children with a BoxFitter. Its dimensions (width and height) are not determined by its children but by the table layout algorithm. Furthermore, its style can be used for drawing e.g. a cell border.

Cell borders work similar to the separated borders model of CSS, i.e. each cell has its own borders that do not overlap.

Attributes

children[RW]

The boxes to layout inside this cell.

This may either be nil (if the cell has no content), a single Box instance or an array of Box instances.

col_span[R]

The number of columns this cell spans.

column[R]

The 0-based column number of the cell.

left[RW]

The x-coordinate of the cell’s top-left corner.

The coordinate is relative to the table’s content rectangle, with positive x-axis going to the right and positive y-axis going to the bottom.

This value is set by the parent Cells object during fitting and may therefore only be relied on afterwards.

preferred_height[R]

The preferred height of the cell, determined during fit.

preferred_width[R]

The preferred width of the cell, determined during fit.

row[R]

The 0-based row number of the cell.

row_span[R]

The number of rows this cell spans.

top[RW]

The y-coordinate of the cell’s top-left corner.

The coordinate is relative to the table’s content rectangle, with positive x-axis going to the right and positive y-axis going to the bottom.

This value is set by the parent Cells object during fitting and may therefore only be relied on afterwards.

Public Class Methods

new(row:, column:, children: nil, row_span: nil, col_span: nil, **kwargs)

Creates a new Cell instance.

Calls superclass method HexaPDF::Layout::Box::new

Public Instance Methods

empty?()

Returns true if the cell has no content.

Calls superclass method HexaPDF::Layout::Box#empty?
fit(available_width, available_height, frame)

Fits the children of the table cell into the given rectangular area.

update_height(height)

Updates the height of the box to the given value.

The height has to be greater than or equal to the fitted height.