Sha256: 2a9d657af095d216702354cb6c2f7c2f74b6d616b7e33d1b9eb1ee3fefc0b6e5

Contents?: true

Size: 1.33 KB

Versions: 1

Compression:

Stored size: 1.33 KB

Contents

module Axlsx

  # Page setup properties of the worksheet
  # This class name is not a typo, its spec.
  class PageSetUpPr

    # creates a new page setup properties object
    # @param [Hash] options
    # @option [Boolean] auto_page_breaks Flag indicating whether the sheet displays Automatic Page Breaks.
    # @option [Boolean] fit_to_page Flag indicating whether the Fit to Page print option is enabled.
    def initialize(options = {})
      options.each do |key, value|
        self.send("#{key}=",value) if self.respond_to?("#{key}=")
      end
    end

    attr_reader :auto_page_breaks
    attr_reader :fit_to_page

    # Flag indicating whether the Fit to Page print option is enabled.
    # @param [Boolean] value
    # @return [Boolean]
    def fit_to_page=(value)
      Axlsx.validate_boolean value
      @fit_to_page = value
    end

    # Flag indicating whether the sheet displays Automatic Page Breaks.
    # @param [Boolean] value
    # @return [Boolean]
    def auto_page_breaks=(value)
      Axlsx.validate_boolean value
      @auto_page_breaks = value
    end

    # serialize to xml
    def to_xml_string(str='')
      str << '<pageSetUpPr ' << serialized_attributes << '/>'
    end

    private

    def serialized_attributes
      instance_values.map { |key, value| "#{Axlsx.camel(key, false)}='#{value}'" }.join(' ')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axlsx-1.3.1 lib/axlsx/workbook/worksheet/page_set_up_pr.rb