Sha256: e28cf6c5d3be438c3b474008be21b29e703d047028a2eb754c1cb93ac8440332
Contents?: true
Size: 1 KB
Versions: 40
Compression:
Stored size: 1 KB
Contents
# frozen_string_literal: true module OoxmlParser # Character Alignment in XLSX class XlsxAlignment < OOXMLDocumentObject attr_accessor :horizontal, :vertical, :wrap_text, :text_rotation def initialize(params = {}) @horizontal = params.fetch(:horizontal, :left) @vertical = params.fetch(:vertical, :bottom) @wrap_text = params.fetch(:wrap_text, false) super(parent: params[:parent]) end # Parse XlsxAlignment object # @param node [Nokogiri::XML:Element] node to parse # @return [XlsxAlignment] result of parsing def parse(node) node.attributes.each do |key, value| case key when 'horizontal' @horizontal = value.value.to_sym @wrap_text = true if @horizontal == :justify when 'vertical' @vertical = value.value.to_sym when 'wrapText' @wrap_text = value.value.to_s == '1' when 'textRotation' @text_rotation = value.value.to_i end end self end end end
Version data entries
40 entries across 40 versions & 1 rubygems