class RubyXL::WorkbookRelationships

def before_write_xml

def before_write_xml
  self.relationships = []
  @workbook.worksheets.each_with_index { |sheet, i|
    relationships << new_relationship(sheet.xlsx_path.gsub(/\Axl\//, ''), sheet.class::REL_TYPE)
  }
   @workbook.external_links.each_key { |k| 
     relationships << new_relationship("externalLinks/#{k}", 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink')
   }
  relationships << new_relationship('theme/theme1.xml', @workbook.theme.class::REL_TYPE) if @workbook.theme
  relationships << new_relationship('styles.xml', @workbook.stylesheet.class::REL_TYPE) if @workbook.stylesheet
  if @workbook.shared_strings_container && !@workbook.shared_strings_container.strings.empty? then
    relationships << new_relationship('sharedStrings.xml', @workbook.shared_strings_container.class::REL_TYPE)
  end
  if @workbook.calculation_chain && !@workbook.calculation_chain.cells.empty? then
    relationships << new_relationship('calcChain.xml', @workbook.calculation_chain.class::REL_TYPE)
  end
  true
end