Class | Prawn::Table::Cell
In: | lib/prawn/table/cell.rb
Parent: | Object

A cell is a special-purpose bounding box designed to flow text within a bordered area. This is used by Prawn‘s Document::Table implementation but can also be used standalone for drawing text boxes via Document#cell

### Methods

draw height new text_area_height text_area_width to_s width

### Attributes

align | [RW] |
background_color | [RW] |
border_color | [RW] |
border_style | [RW] |
border_width | [RW] |
borders | [RW] |
document | [RW] |
font_size | [RW] |
font_style | [RW] |
horizontal_padding | [RW] |
point | [RW] |
text_color | [RW] |
vertical_padding | [RW] |

### Public Class methods

new(options={})

Creates a new cell object. Generally used indirectly via Document#cell

Of the available options listed below, `:point`, `:width`, and `:text` must be provided. If you are not using the Document#cell shortcut, the `:document` must also be provided.

`:point`: | Absolute [x,y] coordinate of the top-left corner of the cell.
`:document`: | The Prawn::Document object to render on.
`:text`: | The text to be flowed within the cell
`:text_color`: | The color of the text to be displayed
`:width`: | The width in PDF points of the cell.
`:height`: | The height in PDF points of the cell.
`:horizontal_padding`: | The horizontal padding in PDF points
`:vertical_padding`: | The vertical padding in PDF points
`:padding`: | Overrides both horizontal and vertical padding
`:align`: | One of `:left`, `:right`, `:center`
`:borders`: | An array of sides which should have a border. Any of `:top`, `:left`, `:right`, `:bottom`
`:border_width`: | The border line width. Defaults to 1.
`:border_style`: | One of `:all`, `:no_top`, `:no_bottom`, `:sides`, `:none`, `:bottom_only`. Defaults to :all.
`:border_color`: | The color of the cell border.
`:font_size`: | The font size for the cell text.
`:font_style`: | The font style for the cell text.

### Public Instance methods

draw()

Draws the cell onto the PDF document

height()

The height of the cell in PDF points

text_area_height()

The height of the text area excluding the vertical padding

text_area_width()

The width of the text area excluding the horizonal padding

to_s()

Returns the cell‘s text as a string.

width()

The width of the cell in PDF points

[Validate]