Sha256: 7f86f59f3fea4b7d492880906fc4b9442b9617b16d31db520bc82c5484ea2713

Contents?: true

Size: 1.3 KB

Versions: 6

Compression:

Stored size: 1.3 KB

Contents

module Axlsx
  # An override content part. These parts are automatically created by for you based on the content of your package.
  class Override

    # @return [String] ContentType The type of content. TABLE_CT, WORKBOOK_CT, APP_CT, RELS_CT, STYLES_CT, XML_CT, WORKSHEET_CT, SHARED_STRINGS_CT, CORE_CT, CHART_CT, DRAWING_CT are allowed
    attr_accessor :ContentType

    # @return [String] PartName The name and location of the part.
    attr_accessor :PartName

    #Creates a new Override object
    # @option options [String] PartName
    # @option options [String] ContentType
    # @raise [ArgumentError] An argument error is raised if both PartName and ContentType are not specified.
    def initialize(options={})
      raise ArugumentError, "PartName and ContentType are required" unless options[:PartName] && options[:ContentType]
      options.each do |o|
        self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
      end      
    end
    def PartName=(v) Axlsx::validate_string v; @PartName = v end
    def ContentType=(v) Axlsx::validate_content_type v; @ContentType = v end

    # Serializes the Override object to xml
    # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
    def to_xml(xml)
      xml.Override(self.instance_values)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
axlsx-1.0.7 lib/axlsx/content_type/override.rb~
axlsx-1.0.6 lib/axlsx/content_type/override.rb~
axlsx-1.0.5 lib/axlsx/content_type/override.rb~
axlsx-1.0.4 lib/axlsx/content_type/override.rb~
axlsx-1.0.3 lib/axlsx/content_type/override.rb~
axlsx-1.0.1 lib/axlsx/content_type/override.rb~