class Xlsxrb::Ooxml::Reader::SheetPropertiesListener
SAX2 listener for parsing <sheetPr> element (tabColor, outlinePr).
Attributes
Public Class Methods
Source
# File lib/xlsxrb/ooxml/reader.rb, line 3130 def initialize @properties = {} @inside_sheet_pr = false end
Public Instance Methods
# File lib/xlsxrb/ooxml/reader.rb, line 3188 def end_element(_uri, local_name, qname) name = element_name(local_name, qname) @inside_sheet_pr = false if name == "sheetPr" end
# File lib/xlsxrb/ooxml/reader.rb, line 3135 def start_element(_uri, local_name, qname, attributes) name = element_name(local_name, qname) case name when "sheetPr" @inside_sheet_pr = true sh = attributes["syncHorizontal"] @properties[:sync_horizontal] = %w[1 true].include?(sh) unless sh.nil? sv = attributes["syncVertical"] @properties[:sync_vertical] = %w[1 true].include?(sv) unless sv.nil? @properties[:sync_ref] = attributes["syncRef"] if attributes["syncRef"] te = attributes["transitionEvaluation"] @properties[:transition_evaluation] = %w[1 true].include?(te) unless te.nil? tent = attributes["transitionEntry"] @properties[:transition_entry] = %w[1 true].include?(tent) unless tent.nil? @properties[:code_name] = attributes["codeName"] if attributes["codeName"] fm = attributes["filterMode"] @properties[:filter_mode] = %w[1 true].include?(fm) unless fm.nil? pub = attributes["published"] @properties[:published] = %w[1 true].include?(pub) unless pub.nil? efcc = attributes["enableFormatConditionsCalculation"] @properties[:enable_format_conditions_calculation] = %w[1 true].include?(efcc) unless efcc.nil? when "tabColor" if @inside_sheet_pr @properties[:tab_color] = attributes["rgb"] if attributes["rgb"] @properties[:tab_color_theme] = attributes["theme"].to_i if attributes["theme"] @properties[:tab_color_tint] = attributes["tint"].to_f if attributes["tint"] @properties[:tab_color_indexed] = attributes["indexed"].to_i if attributes["indexed"] @properties[:tab_color_auto] = %w[1 true].include?(attributes["auto"]) if attributes["auto"] end when "outlinePr" if @inside_sheet_pr apply_s = attributes["applyStyles"] @properties[:apply_styles] = %w[1 true].include?(apply_s) unless apply_s.nil? sb = attributes["summaryBelow"] @properties[:summary_below] = %w[1 true].include?(sb) unless sb.nil? sr = attributes["summaryRight"] @properties[:summary_right] = %w[1 true].include?(sr) unless sr.nil? sos = attributes["showOutlineSymbols"] @properties[:show_outline_symbols] = %w[1 true].include?(sos) unless sos.nil? end when "pageSetUpPr" if @inside_sheet_pr ftp = attributes["fitToPage"] @properties[:fit_to_page] = %w[1 true].include?(ftp) unless ftp.nil? apb = attributes["autoPageBreaks"] @properties[:auto_page_breaks] = %w[1 true].include?(apb) unless apb.nil? end when "sheetCalcPr" fcol = attributes["fullCalcOnLoad"] @properties[:full_calc_on_load] = %w[1 true].include?(fcol) unless fcol.nil? end end