class OoxmlParser::ConditionalFormattingRule
Class for ‘cfRule` data
Attributes
@return [Boolean] Specifies whether rule highlights values above average
@return [Symbol] Specifies whether top/bottom rule highlights bottom values
@return [ColorScale] color scale formatting
@return [DataBar] data bar formatting
@return [Boolean] Specifies whether rule highlights values equal to average
@return [Integer] index of format
@return [Array<Formula>] Formulas to determine condition
@return [IconSet] icon set formatting
@return [String] ID of rule
@return [Symbol] Relational operator in value rule
@return [Symbol] Specifies whether percent is used in top/bottom rule
@return [Integer] Specifies position on the list of rules
@return [Integer] Number of items in top/bottom rule
@return [DifferentialFormattingRecord] Format
@return [Integer] Number of standard deviations in above/below average rule
@return [Symbol] Specifies whether rules with lower priority should be applied over this rule
@return [Symbol] Time period in date rule
@return [Symbol] Type of rule
Public Class Methods
Source
# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule.rb, line 49 def initialize(parent: nil) @above_average = true @formulas = [] super end
OoxmlParser::OOXMLDocumentObject::new
Public Instance Methods
Source
# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule.rb, line 110 def format return @rule_format if @rule_format return nil unless @format_index root_object.style_sheet.differential_formatting_records[@format_index] end
@return [nil, DifferentialFormattingRecord] format of rule
Source
# File lib/ooxml_parser/xlsx_parser/workbook/worksheet/table_part/extension_list/extension/conditional_formattings/conditional_formatting/conditional_formatting_rule.rb, line 58 def parse(node) node.attributes.each do |key, value| case key when 'type' @type = value.value.to_sym when 'priority' @priority = value.value.to_i when 'id' @id = value.value.to_s when 'dxfId' @format_index = value.value.to_i when 'stopIfTrue' @stop_if_true = attribute_enabled?(value) when 'operator' @operator = value.value.to_sym when 'bottom' @bottom = attribute_enabled?(value) when 'percent' @percent = attribute_enabled?(value) when 'rank' @rank = value.value.to_i when 'aboveAverage' @above_average = attribute_enabled?(value) when 'equalAverage' @equal_average = attribute_enabled?(value) when 'stdDev' @standard_deviation = value.value.to_i when 'text' @text = value.text.to_s when 'timePeriod' @time_period = value.value.to_sym end end node.xpath('*').each do |node_child| case node_child.name when 'f' @formulas << Formula.new(parent: self).parse(node_child) when 'dxf' @rule_format = DifferentialFormattingRecord.new(parent: self).parse(node_child) when 'dataBar' @data_bar = DataBar.new(parent: self).parse(node_child) when 'colorScale' @color_scale = ColorScale.new(parent: self).parse(node_child) when 'iconSet' @icon_set = IconSet.new(parent: self).parse(node_child) end end self end
Parse ConditionalFormattingRule
data @param [Nokogiri::XML:Element] node with ConditionalFormattingRule
data @return [ConditionalFormattingRule] value of ConditionalFormattingRule
data