Method: Axlsx::Worksheet#to_xml_string

Defined in:
lib/axlsx/workbook/worksheet/worksheet.rb

#to_xml_stringString

Serializes the worksheet object to an xml string This intentionally does not use nokogiri for performance reasons

Returns:

  • (String)


493
494
495
496
497
498
499
500
501
# File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 493

def to_xml_string
  str = '<?xml version="1.0" encoding="UTF-8"?>'
  str << worksheet_node
  serializable_parts.each do |item|
    item.to_xml_string(str) if item
  end
  str << '</worksheet>'
  str.gsub(/[[:cntrl:]]/,'')
end