123456789_123456789_123456789_123456789_123456789_

Class: Layout::TableCell

Relationships
Inherits: Object

Overview

A TableCell is a single cell from a table that contains data.

Examples:

bounds = Geom::Bounds2d.new(1, 1, 4, 4)
rows = 4
columns = 4
table = Layout::Table.new(bounds, rows, columns)
table.each { |cell|
  puts cell.data.plain_text
}

Version:

  • LayOut 2018

Constant Summary

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#data (rw)

The #data method creates a copy of the FormattedText for the TableCell.

Examples:

bounds = Geom::Bounds2d.new(1, 1, 4, 4)
rows = 4
columns = 4
table = Layout::Table.new(bounds, rows, columns)
cell_entity = table[1, 2].data

Raises:

Version:

  • LayOut 2018

#data=(entity) (rw)

Note:

At the moment, this only works for Entitys that are FormattedTexts. However, future versions of LayOut may support other types of Entitys for TableCells, so this method cannot be assumed to always fail with inputs of other Entity types.

The #data= method sets the Entity of a TableCell. The text content and fill Style settings will be kept. The bounds and other Style settings are controlled by the Table. If the specified row and column is within a merged cell, then the merged cell itself will be affected.

Examples:

bounds = Geom::Bounds2d.new(1, 1, 4, 4)
rows = 4
columns = 4
table = Layout::Table.new(bounds, rows, columns)
anchor = Geom::Point2d.new(1, 1)
text_anchor_type = Layout::FormattedText::ANCHOR_TYPE_TOP_LEFT
text = Layout::FormattedText.new("Test", anchor, text_anchor_type)
table[1, 2].data = text

Parameters:

Raises:

Version:

  • LayOut 2018

#rotationInteger (rw)

The #rotation method returns the rotation of a TableCell.

The rotation type can be one of the following values:

Layout::TableCell::ROTATION_0
Layout::TableCell::ROTATION_90
Layout::TableCell::ROTATION_180
Layout::TableCell::ROTATION_270

Examples:

bounds = Geom::Bounds2d.new(1, 1, 4, 4)
rows = 4
columns = 4
table = Layout::Table.new(bounds, rows, columns)
rotation = table[1, 1].rotation

Raises:

  • (ArgumentError)

    if the cell is invalid due to residing within a merged cell

Version:

  • LayOut 2018

#rotation=(cell_rotation) (rw)

The #rotation= method sets the rotation of a TableCell.

The rotation type can be one of the following values:

Layout::TableCell::ROTATION_0
Layout::TableCell::ROTATION_90
Layout::TableCell::ROTATION_180
Layout::TableCell::ROTATION_270

Examples:

bounds = Geom::Bounds2d.new(1, 1, 4, 4)
rows = 4
columns = 4
table = Layout::Table.new(bounds, rows, columns)
table[1, 1].rotation = Layout::TableCell::ROTATION_180

Parameters:

  • cell_rotation (Integer)

Raises:

Version:

  • LayOut 2018

Instance Method Details

#spanArray(Integer, Integer)

The #span method returns the row and column span of a TableCell. If the values returned are both 1, then it is a normal, non-merged cell. If either of the values are greater than 1, then it is a merged cell. If the values are both 0, then it is an unused cell that resides within the inner portion of another merged cell.

Examples:

bounds = Geom::Bounds2d.new(1, 1, 4, 4)
rows = 4
columns = 4
table = Layout::Table.new(bounds, rows, columns)
row_span, column_span = table[1, 1].span

Returns:

  • (Array(Integer, Integer))

    Row span and column span.

Version:

  • LayOut 2018