Sha256: 17276984c13674c4be276d335e289328804fc52e2045ddb6b64ec8fdeb404415
Contents?: true
Size: 1.91 KB
Versions: 8
Compression:
Stored size: 1.91 KB
Contents
module Axlsx # A PatternFill is the pattern and solid fill styling for a cell. # @note The recommended way to manage styles is with Styles#add_style # @see Style#add_style class PatternFill # The color to use for the the background in solid fills. # @return [Color] attr_accessor :fgColor # The color to use for the background of the fill when the type is not solid. # @return [Color] attr_accessor :bgColor # The pattern type to use # @note # patternType must be one of # :none # :solid # :mediumGray # :darkGray # :lightGray # :darkHorizontal # :darkVertical # :darkDown # :darkUp # :darkGrid # :darkTrellis # :lightHorizontal # :lightVertical # :lightDown # :lightUp # :lightGrid # :lightTrellis # :gray125 # :gray0625 # @see Office Open XML Part 1 18.18.55 attr_accessor :patternType # Creates a new PatternFill Object # @option options [Symbol] patternType # @option options [Color] fgColor # @option options [Color] bgColor def initialize(options={}) @patternType = :none options.each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end end def fgColor=(v) DataTypeValidator.validate "PatternFill.fgColor", Color, v; @fgColor=v end def bgColor=(v) DataTypeValidator.validate "PatternFill.bgColor", Color, v; @bgColor=v end def patternType=(v) Axlsx::validate_pattern_type v; @patternType = v end # Serializes the pattern fill # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. # @return [String] def to_xml(xml) xml.patternFill(:patternType => self.patternType) { self.instance_values.reject { |k,v| k.to_sym == :patternType }.each { |k,v| xml.send(k, v.instance_values) } } end end end
Version data entries
8 entries across 8 versions & 1 rubygems