Sha256: 6771aec6de154c7e982304b54f76b1abfbdde6d56b68b0d07fa81437ed491f14
Contents?: true
Size: 1022 Bytes
Versions: 62
Compression:
Stored size: 1022 Bytes
Contents
require 'docx' # Use case to abstract FORM from word document class Eco::API::UseCases::OozeSamples::OozeFromDocCase < Eco::API::UseCases::OozeSamples::OozeUpdateCase name "ooze-forms-case" type :other private def with_column(num = 0) with_tables do |table, i| raise "Column num (#{num}) is to big. Table '#{i}' only has #{table.column_count} columns." if table.column_count < num table.columns[num].cells.each_with_index do |cell_row, j| txt = normalize_string(cell_row.text) yield(txt, i, j, table, cell_row) end end end def with_tables raise "There are no tables in the doc" unless table_count > 0 i = 0 doc.tables.each do |table| yield(table, i) if block_given? i += 1 end end def table_count doc.tables.count end def tables? table_count > 0 end def doc @doc ||= Docx::Document.open(input_file) end def input_file options.dig(:source, :file) end end
Version data entries
62 entries across 62 versions & 1 rubygems