Class: DocParser::XLSXOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/docparser/output/xlsx_output.rb

Overview

The XLSXOutput class generates Microsoft Excel compatible .xlsx files using the great axslx library

See Also:

Instance Attribute Summary

Attributes inherited from Output

#filename

Instance Method Summary collapse

Methods inherited from Output

#add_row, #close, #header=, #initialize

Constructor Details

This class inherits a constructor from DocParser::Output

Instance Method Details


24
25
26
27
28
29
# File 'lib/docparser/output/xlsx_output.rb', line 24

def footer
  unless @header.nil?
    @sheet.add_table "A1:#{@sheet.cells.last.r}", name: 'Data'
  end
  @package.serialize @filename
end

#headerObject


16
17
18
# File 'lib/docparser/output/xlsx_output.rb', line 16

def header
  write_row @header
end

#rowcountObject


31
32
33
34
35
36
37
# File 'lib/docparser/output/xlsx_output.rb', line 31

def rowcount
  if @header.nil?
    @sheet.rows.length
  else
    @sheet.rows.length - 1
  end
end

#write_row(row) ⇒ Object


20
21
22
# File 'lib/docparser/output/xlsx_output.rb', line 20

def write_row(row)
  @sheet.add_row row
end