Class: RubyXL::Writer::SharedStringsWriter

Inherits:
GenericWriter show all
Defined in:
lib/rubyXL/writer/shared_strings_writer.rb

Instance Method Summary collapse

Methods inherited from GenericWriter

#add_to_zip, #initialize, #render_xml

Constructor Details

This class inherits a constructor from RubyXL::Writer::GenericWriter

Instance Method Details

#filepathObject



5
6
7
# File 'lib/rubyXL/writer/shared_strings_writer.rb', line 5

def filepath
  File.join('xl', 'sharedStrings.xml')
end

#writeObject



9
10
11
12
13
14
15
16
17
# File 'lib/rubyXL/writer/shared_strings_writer.rb', line 9

def write()
  # Excel doesn't care much about the contents of sharedStrings.xml -- it will fill it in, but the file has to exist and have a root node.
  if @workbook.shared_strings_XML
    contents = @workbook.shared_strings_XML
  else
    contents = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+"\n"+'<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="0" uniqueCount="0"></sst>'
  end
  contents
end