Sha256: 45deee5be27f7c6e58f15e4084044a191ebfde62b3506bc11a890e5bfce961d0

Contents?: true

Size: 708 Bytes

Versions: 28

Compression:

Stored size: 708 Bytes

Contents

# frozen_string_literal: true

module OoxmlParser
  # Class for parsing `settings.xml` file
  class DocumentSettings < OOXMLDocumentObject
    # @return [OoxmlSize] size of default tab
    attr_accessor :default_tab_stop

    # Parse Settings object
    # @return [DocumentSettings] result of parsing
    def parse
      settings_path = "#{OOXMLDocumentObject.path_to_folder}word/settings.xml"
      return nil unless File.exist?(settings_path)

      doc = parse_xml(settings_path)
      doc.xpath('w:settings/*').each do |node_child|
        case node_child.name
        when 'defaultTabStop'
          @default_tab_stop = OoxmlSize.new.parse(node_child)
        end
      end
      self
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ooxml_parser-0.29.0 lib/ooxml_parser/docx_parser/document_structure/document_settings.rb
ooxml_parser-0.28.0 lib/ooxml_parser/docx_parser/document_structure/document_settings.rb
ooxml_parser-0.27.0 lib/ooxml_parser/docx_parser/document_structure/document_settings.rb
ooxml_parser-0.26.0 lib/ooxml_parser/docx_parser/document_structure/document_settings.rb
ooxml_parser-0.25.0 lib/ooxml_parser/docx_parser/document_structure/document_settings.rb
ooxml_parser-0.24.0 lib/ooxml_parser/docx_parser/document_structure/document_settings.rb
ooxml_parser-0.23.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.22.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.21.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.20.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.19.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.18.1 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.18.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.17.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.16.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.15.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.14.2 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.14.1-mingw32 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.14.1 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb
ooxml_parser-0.14.0 lib/ooxml_parser/docx_parser/docx_data/document_structure/document_settings.rb