Class: RubyXL::WorkbookRelationships
- Inherits:
-
OOXMLRelationshipsFile
- Object
- OOXMLObject
- OOXMLTopLevelObject
- OOXMLRelationshipsFile
- RubyXL::WorkbookRelationships
- Defined in:
- lib/rubyXL/objects/relationships.rb
Instance Attribute Summary collapse
-
#workbook ⇒ Object
Returns the value of attribute workbook.
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from OOXMLRelationshipsFile
Methods inherited from OOXMLTopLevelObject
#add_to_zip, parse_file, set_namespaces, #xlsx_path
Methods included from OOXMLObjectClassMethods
#define_attribute, #define_child_node, #define_element_name, #obtain_class_variable, #parse, #set_countable
Methods included from OOXMLObjectInstanceMethods
#dup, #index_in_collection, #initialize, #write_xml
Instance Attribute Details
#workbook ⇒ Object
Returns the value of attribute workbook.
47 48 49 |
# File 'lib/rubyXL/objects/relationships.rb', line 47 def workbook @workbook end |
Class Method Details
.xlsx_path ⇒ Object
74 75 76 |
# File 'lib/rubyXL/objects/relationships.rb', line 74 def self.xlsx_path File.join('xl', '_rels', 'workbook.xml.rels') end |
Instance Method Details
#before_write_xml ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/rubyXL/objects/relationships.rb', line 49 def before_write_xml self.relationships = [] @workbook.worksheets.each_with_index { |sheet, i| relationships << document_relationship(sheet.xlsx_path.gsub(/^xl\//, ''), sheet.rel_type) } @workbook.external_links.each_key { |k| relationships << document_relationship("externalLinks/#{k}", 'externalLink') } relationships << document_relationship('theme/theme1.xml', 'theme') relationships << document_relationship('styles.xml', 'styles') if @workbook.shared_strings_container && !@workbook.shared_strings_container.strings.empty? then relationships << document_relationship('sharedStrings.xml', 'sharedStrings') end if @workbook.calculation_chain && !@workbook.calculation_chain.cells.empty? then relationships << document_relationship('calcChain.xml', 'calcChain') end true end |