class RubyXL::Text

www.schemacentral.com/sc/ooxml/e-ssml_t-1.html

Constants

ESCAPED_UNICODE
INVALID_XML10_CHARS

www.w3.org/TR/REC-xml/#NT-Char: Char ::= x9 | xA | xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]

Public Instance Methods

before_write_xml() click to toggle source
# File lib/rubyXL/objects/text.rb, line 20
def before_write_xml
  self.xml_space = (value.is_a?(String) && ((value =~ /\A\s/) || (value =~ /\s\Z/) || value.include?("\n"))) ? 'preserve' : nil
  self.value.gsub!(INVALID_XML10_CHARS) { |c| "_x%04x_" % c.ord }
  true
end
to_s() click to toggle source
# File lib/rubyXL/objects/text.rb, line 26
def to_s
  value.to_s.gsub(ESCAPED_UNICODE) { |m| $1.hex.chr }
end