-
Notifications
You must be signed in to change notification settings - Fork 2
Access layer notes
Saverio Miroddi edited this page Jun 28, 2017
·
1 revision
document = Document.new
tables = document.tables
value = table[1, 2]
value = table['A', 2] # the column name is case-insensitive
row_values = table.row(1) # no styles are included; only data
The first entry is the name; the second, the columns; the other, the rows.
document.tables << Table.new(
'abc', [],
[my_style, 'abc', [my_date, my_style_3]],
[ [123, my_style_2] , my_date ],
]
In each row, if first entry is a Style, it's the row style.
Each data entry can have two formats:
<object>
[<object>, <style>]
An <object> can be nil.
table[1, 2] = 'abc'
table[1, 3] = ['abc', my_style]
table['A', 2] = 'abc' # column is case-insensitive
If a cell has an value/date-value/formula, but no text, an error will be raised.
Date styles don't have the same semantic of the openoffice specification, where they are templates. here they are merged into the style concept - the layer will take care of translating between the domains.
document.styles << Style.new('style_name', :bold, date: 'YYYY-MM-DD')
Names must be unique; adding a new style with an existing name will raise an error.