Sha256: d97110f426057a44248503578777b83a97dba557e66260e7d27733d4e471d8d4

Contents?: true

Size: 1.9 KB

Versions: 7

Compression:

Stored size: 1.9 KB

Contents

module OpenXml
  module Docx
    module Elements
      class Paragraph < OpenXml::Docx::Element
        include HasChildren, HasProperties

        attr_reader :section_properties
        tag :p

        value_property :alignment
        value_property :auto_adjust_right_indent
        value_property :auto_space_de
        value_property :auto_space_dn
        value_property :bidi
        value_property :compress_punctuation
        value_property :contextual_spacing
        value_property :div_id
        value_property :keep_lines
        value_property :keep_next
        value_property :mirror_indent
        value_property :outline_level
        value_property :overflow_punctuation
        value_property :page_break_before
        value_property :snap_to_grid
        value_property :paragraph_style
        value_property :supress_auto_hyphens
        value_property :supress_line_numbers
        value_property :supress_overlap
        value_property :textbox_tight_wrap
        value_property :text_alignment
        value_property :text_direction
        value_property :widow_control
        value_property :word_wrap

        property :borders, as: :paragraph_borders
        property :conditional_formatting
        property :frame
        property :indentation
        property :numbering
        property :shading
        property :spacing
        property :tabs
        property :section

        def section_properties=(section)
          raise ArgumentError, "Section properties must be an instance of OpenXml::Docx::Section" unless section.is_a?(OpenXml::Docx::Section)
          @section_properties = section
        end

        def to_xml(xml)
          xml[namespace].public_send(tag, xml_attributes) {
            section_properties.to_xml(xml) unless section_properties.nil?
            property_xml(xml)
            children.each { |child| child.to_xml(xml) }
          }
        end

      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
openxml-docx-0.11.5 lib/openxml/docx/elements/paragraph.rb
openxml-docx-0.11.4 lib/openxml/docx/elements/paragraph.rb
openxml-docx-0.11.3 lib/openxml/docx/elements/paragraph.rb
openxml-docx-0.11.2 lib/openxml/docx/elements/paragraph.rb
openxml-docx-0.11.1 lib/openxml/docx/elements/paragraph.rb
openxml-docx-0.11.0 lib/openxml/docx/elements/paragraph.rb
openxml-docx-0.11.0.rc lib/openxml/docx/elements/paragraph.rb