Class PDF::SimpleTable
In: lib/pdf/simpletable.rb
Parent: Object

This class will create tables with a relatively simple API and internal implementation.

Methods

new   render_on  

Included Modules

Transaction::Simple

Classes and Modules

Class PDF::SimpleTable::Column

Constants

VERSION = '1.1.3'
WIDTH_FACTOR = 1.01

Attributes

bold_headings  [RW]  Makes the heading text bold if true. Defaults to false.
column_gap  [RW]  The space, in PDF user units, on the left and right sides of each cell. Default 5 units.
column_order  [RW]  An array that defines the order of the columns in the table. The values in this array are the column names in data. The columns will be presented in the order defined here.
columns  [RW]  An array that defines columns and column options for the table. The entries should be PDF::SimpleTable::Column objects.
data  [RW]  An array of Hash entries. Each row is a Hash where the keys are the names of the columns as specified in column_order and the values are the values of the cell.
font_size  [RW]  The font size of the data cells, in points. Defaults to 10 points.
header_gap  [RW]  The number of PDF user units to leave open at the top of a page after a page break. This is typically used for a repeating page header, etc. Defaults to zero units.
heading_color  [RW]  The text colour of the heading. Defaults to Color::RGB::Black.
heading_font_size  [RW]  The font size of the heading cells, in points. Defaults to 12 points.
inner_line_style  [RW]  Defines the inner line style. The default style is a solid line with a thickness of 1 unit.
line_color  [RW]  The colour of the table lines. Defaults to Color::RGB::Black.
maximum_width  [RW]  Specifies the maximum width of the table. The table will not grow larger than this width under any circumstances.

Defaults to zero, which indicates that there is no maximum width (aside from the margin size).

minimum_space  [RW]  The minimum space between the bottom of each row and the bottom margin. If the amount of space is less than this, a new page will be started. Default is 100 PDF user units.
orientation  [RW]  The orientation of the table relative to position.
:left:The table is to the left of position.
:right:The table is to the right of position.
:center:The table is centred at position.
offset:The left of the table is offset from position.
outer_line_style  [RW]  Defines the outer line style. The default style is a solid line with a thickness of 1 unit.
position  [RW]  The x position of the table. This will be one of:
:left:Aligned with the left margin.
:right:Aligned with the right margin.
:center:Centered between the margins. Default.
offset:The absolute position of the table, relative from the left margin.
protect_rows  [RW]  The number of rows to hold with the heading on the page. If there are less than this number of rows on the page, then move the whole lot onto the next page. Default is one row.
row_gap  [RW]  The space, in PDF user units, added to the top and bottom of each row between the text and the lines of the cell. Default 2 units.
shade_color  [RW]  The main row shading colour. Defaults to Color::RGB::Grey80. Used with shade_rows of :shaded and :striped.
shade_color2  [RW]  The alternate row shading colour, used with shade_rows of :striped. Defaults to Color::RGB::Grey70.
shade_heading_color  [RW]  Defines the colour of the background shading for the heading if shade_headings is true. Default is Color::RGB::Grey90.
shade_headings  [RW]  Places a background colour in the heading if true.
shade_rows  [RW]  Controls row shading.
:none:No row shading; all rows are the standard background colour.
:shaded:Alternate lines will be shaded; half of the rows will be the standard background colour; the rest of the rows will be shaded with shade_color. Default
:striped:Alternate lines will be shaded; half of the rows will be shaded with shade_color; the rest of the rows will be shaded with shade_color2.
show_headings  [RW]  Displays the headings for the table if true. The default is true.
show_lines  [RW]  Whether to display the lines on the table or not. Valid values are:
:none:Displays no lines.
:outer:Displays outer lines only. Default
:inner:Displays inner lines only.
:all:Displays all lines, inner and outer.
split_rows  [RW]  Allows a table‘s rows to be split across page boundaries if true. This defaults to false.
text_color  [RW]  The text colour of the body cells. Defaults to Color::RGB::Black.
title  [RW]  The title to be put on the top of the table.
title_color  [RW]  The text colour of the title. Defaults to Color::RGB::Black.
title_font_size  [RW]  The font size of the title, in points. Defaults to 12 points.
title_gap  [RW]  The gap, in PDF units, between the title and the table. Defaults to 5 units.
width  [RW]  Specifies the width of the table. If the table is smaller than the provided width, columns are proportionally stretched to fit the width of the table. If the table is wider than the provided width, columns are proportionally shrunk to fit the width of the table. Content may need to wrap in this case.

Defaults to zero, which indicates that the size whould be determined automatically based on the content and the margins.

Public Class methods

Public Instance methods

Render the table on the PDF::Writer document provided.

[Validate]