class RubyXL::Writer::SharedStringsWriter

Attributes

dirpath[RW]
filepath[RW]
workbook[RW]

Public Class Methods

new(dirpath,wb) click to toggle source
# File lib/rubyXL/writer/shared_strings_writer.rb, line 13
def initialize(dirpath,wb)
  @dirpath = dirpath
  @workbook = wb
  @filepath = dirpath + '/xl/sharedStrings.xml'
end

Public Instance Methods

write() click to toggle source
# File lib/rubyXL/writer/shared_strings_writer.rb, line 19
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