Sha256: b0695122c1bcf914f7e7261888f5e3896e092e34c3f1dca585786840c7db6222

Contents?: true

Size: 704 Bytes

Versions: 53

Compression:

Stored size: 704 Bytes

Contents

require 'ndr_support/safe_file'

module NdrImport
  module Helpers
    module File
      # This mixin adds Word document functionality to unified importers.
      # It provides a file reader method.
      # currently only works on .doc (97-2003), not.docx
      module Word
        private

        def read_word_file(path)
          require 'msworddoc-extractor'
          lines = []
          begin
            doc = MSWordDoc::Extractor.load(SafeFile.safepath_to_string(path))

            lines.concat doc.whole_contents.split("\n")
          rescue => e
            raise("#{SafeFile.basename(path)} [#{e.class}: #{e.message}]")
          end
          lines
        end
      end
    end
  end
end

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
ndr_import-11.2.1 lib/ndr_import/helpers/file/word.rb
ndr_import-11.2.0 lib/ndr_import/helpers/file/word.rb
ndr_import-11.1.0 lib/ndr_import/helpers/file/word.rb
ndr_import-11.0.2 lib/ndr_import/helpers/file/word.rb
ndr_import-11.0.1 lib/ndr_import/helpers/file/word.rb
ndr_import-11.0.0 lib/ndr_import/helpers/file/word.rb
ndr_import-10.3.0 lib/ndr_import/helpers/file/word.rb
ndr_import-10.2.0 lib/ndr_import/helpers/file/word.rb
ndr_import-10.1.3 lib/ndr_import/helpers/file/word.rb
ndr_import-10.1.2 lib/ndr_import/helpers/file/word.rb
ndr_import-10.1.1 lib/ndr_import/helpers/file/word.rb
ndr_import-10.1 lib/ndr_import/helpers/file/word.rb
ndr_import-10.0 lib/ndr_import/helpers/file/word.rb
ndr_import-9.1.0 lib/ndr_import/helpers/file/word.rb
ndr_import-9.0.3 lib/ndr_import/helpers/file/word.rb
ndr_import-9.0.2 lib/ndr_import/helpers/file/word.rb
ndr_import-9.0.1 lib/ndr_import/helpers/file/word.rb
ndr_import-9.0.0 lib/ndr_import/helpers/file/word.rb
ndr_import-8.6.0 lib/ndr_import/helpers/file/word.rb
ndr_import-8.5.2 lib/ndr_import/helpers/file/word.rb