Class: RubyXL::SharedStringsTable
Overview
Constant Summary
collapse
- CONTENT_TYPE =
'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml'.freeze
- REL_TYPE =
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings'.freeze
OOXMLTopLevelObject::ROOT, OOXMLTopLevelObject::SAVE_ORDER
Instance Attribute Summary
#root
#local_namespaces
Instance Method Summary
collapse
#add_to_zip, #file_index, parse_file, set_namespaces
#==, included, #index_in_collection, #write_xml
Constructor Details
Returns a new instance of SharedStringsTable.
19
20
21
22
23
24
25
|
# File 'lib/rubyXL/objects/shared_strings.rb', line 19
def initialize(*params)
super
@index_by_content = {}
end
|
Instance Method Details
#[](index) ⇒ Object
33
34
35
|
# File 'lib/rubyXL/objects/shared_strings.rb', line 33
def [](index)
strings[index]
end
|
#add(v, index = nil) ⇒ Object
#before_write_xml ⇒ Object
27
28
29
30
31
|
# File 'lib/rubyXL/objects/shared_strings.rb', line 27
def before_write_xml
super
self.unique_count = self.count
self.count > 0
end
|
#empty? ⇒ Boolean
37
38
39
|
# File 'lib/rubyXL/objects/shared_strings.rb', line 37
def empty?
strings.empty?
end
|
#get_index(str, add_if_missing = false) ⇒ Object
57
58
59
60
61
|
# File 'lib/rubyXL/objects/shared_strings.rb', line 57
def get_index(str, add_if_missing = false)
index = @index_by_content[str]
index = add(str) if index.nil? && add_if_missing
index
end
|
#xlsx_path ⇒ Object
63
64
65
|
# File 'lib/rubyXL/objects/shared_strings.rb', line 63
def xlsx_path
ROOT.join('xl', 'sharedStrings.xml')
end
|