Sha256: b4ae1033342f3e8e03ca9a1113fc72e56cb43be00856aec09934d24c68076dd4

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

module DocXify
  module Element
    class Paragraph < Base
      attr_accessor :text, :font, :size, :color, :background, :align, :inline_styling, :tab_stops_cm

      def initialize(document, text, options = {})
        @document = document
        @text = text
        @font = options[:font] || document.font
        @size = options[:size] || document.size
        @color = options[:color] || document.color
        @background = options[:background] if options[:background]
        @background ||= document.background if document.background
        @align = options[:align] || :left
        @inline_styling = options[:inline_styling] || true
        @tab_stops_cm = options[:tab_stops_cm] || []
      end

      def to_s(container = nil)
        # TODO: Implement all optionality
        "<w:p><w:r><w:t xml:space=\"preserve\">#{@text}</w:t></w:r></w:p>"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docxify-0.0.2 lib/docxify/element/paragraph.rb