Sha256: 4848fe442c839c869883f7e5ca0cb75849996b11b1d36943c78f3ef313a5799a

Contents?: true

Size: 1.57 KB

Versions: 6

Compression:

Stored size: 1.57 KB

Contents

module Axlsx
  # The Marker class defines a point in the worksheet that drawing anchors attach to.
  # @note The recommended way to manage markers is Worksheet#add_chart Markers are created for a two cell anchor based on the :start and :end options.
  # @see Worksheet#add_chart
  class Marker

    # The column this marker anchors to
    # @return [Integer]
    attr_accessor :col

    # The offset distance from this marker's column
    # @return [Integer]
    attr_accessor :colOff

    # The row this marker anchors to
    # @return [Integer]
    attr_accessor :row

    # The offset distance from this marker's row
    # @return [Integer]
    attr_accessor :rowOff

    # Creates a new Marker object
    # @option options [Integer] col
    # @option options [Integer] colOff
    # @option options [Integer] row
    # @option options [Integer] rowOff
    def initialize(options={})
      @col, @colOff, @row, @rowOff = 0, 0, 0, 0
      options.each do |o|
        self.send("#{o[0]}=", o[1]) if self.respond_to? o[0]
      end      
    end
    
    def col=(v) Axlsx::validate_unsigned_int v; @col = v end
    def colOff=(v) Axlsx::validate_int v; @colOff = v end
    def row=(v) Axlsx::validate_unsigned_int v; @row = v end
    def rowOff=(v) Axlsx::validate_int v; @rowOff = v end

    # Serializes the gradientStop
    # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
    # @return [String]
    def to_xml(xml)
      [:col, :colOff, :row, :rowOff].each do |k|
        xml.send("xdr:#{k.to_s}", self.send(k))
      end      
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
axlsx-1.0.7 lib/axlsx/drawing/marker.rb~
axlsx-1.0.6 lib/axlsx/drawing/marker.rb~
axlsx-1.0.5 lib/axlsx/drawing/marker.rb~
axlsx-1.0.4 lib/axlsx/drawing/marker.rb~
axlsx-1.0.3 lib/axlsx/drawing/marker.rb~
axlsx-1.0.1 lib/axlsx/drawing/marker.rb~