class RubyXL::WorkbookRelationships

def self.filepath

def self.filepath
  File.join('xl', '_rels', 'workbook.xml.rels')
end

def before_write_xml

def before_write_xml
  self.relationships = []
  @workbook.worksheets.each_with_index { |sheet, i|
    relationships << create_relationship(sheet.filepath.gsub(/^xl\//, ''), sheet.rel_type)
  }
  @workbook.external_links.each_key { |k| 
    relationships << create_relationship("externalLinks/#{k}", 'externalLink')
  }
  relationships << create_relationship('theme/theme1.xml', 'theme')
  relationships << create_relationship('styles.xml', 'styles')
  if @workbook.shared_strings_container && !@workbook.shared_strings_container.strings.empty? then
    relationships << create_relationship('sharedStrings.xml', 'sharedStrings') 
  end
  if @workbook.calculation_chain && !@workbook.calculation_chain.cells.empty? then
    relationships << create_relationship('calcChain.xml', 'calcChain') 
  end
  true
end

def create_relationship(target, type)

def create_relationship(target, type)
  RubyXL::Relationship.new(:id => "rId#{relationships.size + 1}", 
                           :type => "http://schemas.openxmlformats.org/officeDocument/2006/relationships/#{type}",
                           :target => target)
end

def find_by_rid(r_id)

def find_by_rid(r_id)
  relationships.find { |r| r.id == r_id }
end