Class RTF::TableCellNode
In: lib/rtf/node.rb
Parent: CommandNode

This class represents a cell within an RTF table. The TableCellNode is a specialised command node that is forbidden from creating tables or having its parent changed.

Methods

Constants

DEFAULT_WIDTH = 300   A definition for the default width for the cell.

Attributes

shading_colour  [R]  Attribute accessor.
style  [W]  Attribute mutator.
style  [R]  Attribute accessor.
width  [W]  Attribute mutator.
width  [R]  Attribute accessor.

Public Class methods

This is the constructor for the TableCellNode class.

Parameters

row:The row that the cell belongs to.
width:The width to be assigned to the cell. This defaults to TableCellNode::DEFAULT_WIDTH.
style:The style that is applied to the cell. This must be a ParagraphStyle class. Defaults to nil.
top:The border width for the cells top border. Defaults to nil.
right:The border width for the cells right hand border. Defaults to nil.
bottom:The border width for the cells bottom border. Defaults to nil.
left:The border width for the cells left hand border. Defaults to nil.

Exceptions

RTFError:Generated whenever an invalid style setting is specified.

Public Instance methods

This method assigns a width, in twips, for the borders on all sides of the cell. Negative widths will be ignored and a width of zero will switch the border off.

Parameters

width:The setting for the width of the border.

This method retrieves an array with the cell border width settings. The values are inserted in top, right, bottom, left order.

This method fetches the width for bottom border of a cell.

This method assigns a border width to the bottom side of a table cell. Negative values are ignored and a value of 0 switches the border off.

Parameters

width:The new border width setting.

This method fetches the width for left border of a cell.

This method assigns a border width to the left side of a table cell. Negative values are ignored and a value of 0 switches the border off.

Parameters

width:The new border width setting.

This method overloads the paragraph method inherited from the ComamndNode class to forbid the creation of paragraphs.

Parameters

justification:The justification to be applied to the paragraph.
before:The amount of space, in twips, to be inserted before the paragraph. Defaults to nil.
after:The amount of space, in twips, to be inserted after the paragraph. Defaults to nil.
left:The amount of indentation to place on the left of the paragraph. Defaults to nil.
right:The amount of indentation to place on the right of the paragraph. Defaults to nil.
first:The amount of indentation to place on the left of the first line in the paragraph. Defaults to nil.

This method overloads the parent= method inherited from the Node class to forbid the alteration of the cells parent.

Parameters

parent:A reference to the new node parent.

This method fetches the width for right border of a cell.

This method assigns a border width to the right side of a table cell. Negative values are ignored and a value of 0 switches the border off.

Parameters

width:The new border width setting.

This method alters the shading colour associated with a TableCellNode object.

Parameters

colour:A reference to the Colour object to use in shading the cell. Assign nil to clear cell shading.

Attribute mutator.

Parameters

style:A reference to the style object to be applied to the cell. Must be an instance of the ParagraphStyle class. Set to nil to clear style settings.

Exceptions

RTFError:Generated whenever an invalid style setting is specified.

This method overrides the table method inherited from CommandNode to forbid its use in table cells.

Parameters

rows:The number of rows for the table.
columns:The number of columns for the table.
*widths:One or more integers representing the widths for the table columns.

This method generates the RTF document text for a TableCellNode object.

This method fetches the width for top border of a cell.

This method assigns a border width to the top side of a table cell. Negative values are ignored and a value of 0 switches the border off.

Parameters

width:The new border width setting.

[Validate]