class Axlsx::GradientFill

A GradientFill defines the color and positioning for gradiant cell fill. @see Open Office XML Part 1 ยง18.8.24

Attributes

bottom[R]

Percentage format bottom @return [Float]

degree[R]

Angle of the linear gradient @return [Float]

left[R]

Percentage format left @return [Float]

right[R]

Percentage format right @return [Float]

stop[R]

Collection of stop objects @return [SimpleTypedList]

top[R]

Percentage format top @return [Float]

type[R]

The type of gradient. @note

valid options are
 :linear
 :path

@return [Symbol]

Public Class Methods

new(options={}) click to toggle source

Creates a new GradientFill object @option options [Symbol] type @option options [Float] degree @option options [Float] left @option options [Float] right @option options [Float] top @option options [Float] bottom

# File lib/axlsx/stylesheet/gradient_fill.rb, line 17
def initialize(options={})
  options[:type] ||= :linear
  parse_options options
  @stop = SimpleTypedList.new GradientStop
end

Public Instance Methods

bottom=(v) click to toggle source

@see bottom

# File lib/axlsx/stylesheet/gradient_fill.rb, line 82
def bottom=(v)
  validate_format_percentage "GradientFill.bottom", v
  @bottom = v
end
degree=(v) click to toggle source

@see degree

# File lib/axlsx/stylesheet/gradient_fill.rb, line 61
def degree=(v) Axlsx::validate_float v; @degree = v end
left=(v) click to toggle source

@see left

# File lib/axlsx/stylesheet/gradient_fill.rb, line 64
def left=(v)
  validate_format_percentage "GradientFill.left", v
  @left = v
end
right=(v) click to toggle source

@see right

# File lib/axlsx/stylesheet/gradient_fill.rb, line 70
def right=(v)
 validate_format_percentage "GradientFill.right", v
 @right = v
end
to_xml_string(str = '') click to toggle source

Serializes the object @param [String] str @return [String]

# File lib/axlsx/stylesheet/gradient_fill.rb, line 95
def to_xml_string(str = '')
  str << '<gradientFill '
  serialized_attributes str
  str << '>'
  @stop.each { |s| s.to_xml_string(str) }
  str << '</gradientFill>'
end
top=(v) click to toggle source

@see top

# File lib/axlsx/stylesheet/gradient_fill.rb, line 76
def top=(v)
  validate_format_percentage "GradientFill.top", v
  @top = v
end
type=(v) click to toggle source

@see type

# File lib/axlsx/stylesheet/gradient_fill.rb, line 58
def type=(v) Axlsx::validate_gradient_type v; @type = v end
validate_format_percentage(name, value) click to toggle source

validates that the value provided is between 0.0 and 1.0

# File lib/axlsx/stylesheet/gradient_fill.rb, line 88
def validate_format_percentage(name, value)
  DataTypeValidator.validate name, Float, value, lambda { |arg| arg >= 0.0 && arg <= 1.0}
end