lib/rocx/elements/paragraph.rb in rocx-0.6.0 vs lib/rocx/elements/paragraph.rb in rocx-0.7.0

- old
+ new

@@ -1,8 +1,9 @@ module Rocx module Elements class Paragraph < Container + attr_reader :section_properties tag :p value_property :alignment value_property :auto_adjust_right_indent value_property :auto_space_de @@ -26,16 +27,30 @@ value_property :text_alignment value_property :text_direction value_property :widow_control value_property :word_wrap - property :borders + property :borders, as: :paragraph_borders property :conditional_formatting property :frame property :indentation property :numbering property :shading property :spacing property :tabs + + def section_properties=(section) + raise ArgumentError, "Section properties must be an instance of Rocx::Section" unless section.is_a?(Rocx::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