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-4.1.1 lib/ndr_import/helpers/file/word.rb
ndr_import-4.1.0 lib/ndr_import/helpers/file/word.rb
ndr_import-4.0.1 lib/ndr_import/helpers/file/word.rb
ndr_import-4.0.0 lib/ndr_import/helpers/file/word.rb
ndr_import-3.1.6 lib/ndr_import/helpers/file/word.rb
ndr_import-3.1.5 lib/ndr_import/helpers/file/word.rb
ndr_import-3.1.4 lib/ndr_import/helpers/file/word.rb
ndr_import-3.1.3 lib/ndr_import/helpers/file/word.rb
ndr_import-3.1.2 lib/ndr_import/helpers/file/word.rb
ndr_import-3.1.1 lib/ndr_import/helpers/file/word.rb
ndr_import-3.1.0 lib/ndr_import/helpers/file/word.rb
ndr_import-3.0.1 lib/ndr_import/helpers/file/word.rb
ndr_import-3.0.0 lib/ndr_import/helpers/file/word.rb