Class: Spreadsheet::Excel::Worksheet
Overview
Instance Attribute Summary collapse
Attributes included from Offset
#changes, #offsets
Attributes inherited from Worksheet
#columns, #froze_left, #froze_top, #merged_cells, #name, #password_hash, #selected, #workbook
Instance Method Summary
collapse
Methods included from Offset
append_features
#ivar_name, #method_name
Methods inherited from Worksheet
#<<, #[], #[]=, #active, #active=, #add_format, #cell, #column_count, #column_updated, #compact!, #default_format, #default_format=, #delete_row, #dimensions, #encoding, #format_column, #format_dates!, #freeze!, #has_frozen_panel?, #insert_row, #inspect, #last_row, #last_row_index, #merge_cells, #new_format_column, #protect!, #protected?, #replace_row, #row_count, #update_row, #updated_from, #write, #write_column, #write_row, #write_url
Methods included from Datatypes
append_features
Constructor Details
#initialize(opts = {}) ⇒ Worksheet
Returns a new instance of Worksheet.
15
16
17
18
19
20
21
22
23
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 15
def initialize opts = {}
@row_addresses = nil
super
@offset, @ole, @reader = opts[:offset], opts[:ole], opts[:reader]
@dimensions = nil
@links = {}
@guts = {}
@notes = {}
end
|
Instance Attribute Details
#guts ⇒ Object
Returns the value of attribute guts.
14
15
16
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 14
def guts
@guts
end
|
#links ⇒ Object
Returns the value of attribute links.
14
15
16
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 14
def links
@links
end
|
#notes ⇒ Object
Returns the value of attribute notes.
14
15
16
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 14
def notes
@notes
end
|
#offset ⇒ Object
Returns the value of attribute offset.
14
15
16
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 14
def offset
@offset
end
|
#ole ⇒ Object
Returns the value of attribute ole.
14
15
16
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 14
def ole
@ole
end
|
Instance Method Details
#add_link(row, column, link) ⇒ Object
24
25
26
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 24
def add_link row, column, link
@links.store [row, column], link
end
|
#add_note(row, column, note) ⇒ Object
27
28
29
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 27
def add_note row, column, note
@notes.store [row, column], note
end
|
#column(idx) ⇒ Object
30
31
32
33
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 30
def column idx
ensure_rows_read
super
end
|
#date_base ⇒ Object
34
35
36
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 34
def date_base
@workbook.date_base
end
|
#each(*args) ⇒ Object
45
46
47
48
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 45
def each *args
ensure_rows_read
super
end
|
#ensure_rows_read ⇒ Object
49
50
51
52
53
54
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 49
def ensure_rows_read
return if @row_addresses
@dimensions = nil
@row_addresses = []
@reader.read_worksheet self, @offset if @reader
end
|
#margins ⇒ Object
37
38
39
40
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 37
def margins
ensure_rows_read
super
end
|
#pagesetup ⇒ Object
41
42
43
44
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 41
def pagesetup
ensure_rows_read
super
end
|
#row(idx) ⇒ Object
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 55
def row idx
@rows[idx] or begin
ensure_rows_read
if addr = @row_addresses[idx]
row = @reader.read_row self, addr
[:default_format, :height, :outline_level, :hidden, ].each do |key|
row.send "unupdated_#{key}=", addr[key]
end
row.worksheet = self
row
else
Row.new self, idx
end
end
end
|
#row_updated(idx, row) ⇒ Object
73
74
75
76
77
78
79
80
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 73
def row_updated idx, row
res = super
@workbook.changes.store self, true
@workbook.changes.store :boundsheets, true
@changes.store idx, true
@changes.store :dimensions, true
res
end
|
#rows ⇒ Object
70
71
72
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 70
def rows
self.to_a
end
|
#set_row_address(idx, opts) ⇒ Object
81
82
83
84
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 81
def set_row_address idx, opts
@offsets.store idx, opts[:row_block]
@row_addresses[idx] = opts
end
|
#shared_string(idx) ⇒ Object
85
86
87
|
# File 'lib/spreadsheet/excel/worksheet.rb', line 85
def shared_string idx
@workbook.shared_string idx
end
|