Sha256: 6d664d9317f08fdceaeba34603317472345e09f312df8ea6be58d56ac7248bc6

Contents?: true

Size: 632 Bytes

Versions: 1

Compression:

Stored size: 632 Bytes

Contents

require 'axlsx'
module DocParser
  # The XLSXOutput class generates Microsoft Excel compatible .xlsx files
  # using the great axslx library
  # @see Output
  class XLSXOutput < Output
    # @!visibility private
    def open_file
      @package = Axlsx::Package.new
      @package.workbook.date1904 = false # Fix for OS X
      @sheet = @package.workbook.add_worksheet
      @file.close
    end

    def header
      write_row @header
    end

    def write_row(row)
      @sheet.add_row row
    end

    def close
      @sheet.add_table "A1:#{@sheet.cells.last.r}", name: 'Data'
      @package.serialize @filename
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
docparser-0.0.1 lib/docparser/output/xlsx_output.rb