Method: Axlsx::ConditionalFormattingRule#to_xml_string

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

#to_xml_string(str = '') ⇒ String

Serializes the conditional formatting rule

Parameters:

  • str (String) (defaults to: '')

Returns:

  • (String)


209
210
211
212
213
214
215
216
217
218
# File 'lib/axlsx/workbook/worksheet/conditional_formatting_rule.rb', line 209

def to_xml_string(str = '')
  str << '<cfRule '
  serialized_attributes str
  str << '>'
  str << ('<formula>' << [*self.formula].join('</formula><formula>') << '</formula>') if @formula
  @color_scale.to_xml_string(str) if @color_scale && @type == :colorScale
  @data_bar.to_xml_string(str) if @data_bar && @type == :dataBar
  @icon_set.to_xml_string(str) if @icon_set && @type == :iconSet
  str << '</cfRule>'
end