Sha256: db638ad10d1b165568449f304f3c66595b49f5d4683dc63392a295d4ff0c3e55

Contents?: true

Size: 756 Bytes

Versions: 8

Compression:

Stored size: 756 Bytes

Contents

require 'writeexcel'

module Mondrian::REST::Formatters
  module XLS
    def self.call(result, env)
      params = env['api.endpoint'].params
      add_parents = params['parents']
      debug = params['debug']
      sparse = params['sparse']
      properties = params['properties'] || []

      out = StringIO.new
      book = WriteExcel.new(out)
      sheet = book.add_worksheet

      Mondrian::REST::Formatters
        .tidy(result,
              add_parents: add_parents,
              debug: debug,
              sparse: sparse,
              properties: properties)
        .each_with_index do |row, i|
        row.each_with_index { |cell, j|
          sheet.write(i, j, cell)
        }
      end

      book.close
      out.string
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mondrian-rest-1.0.4-java lib/mondrian_rest/formatters/excel.rb
mondrian-rest-1.0.3-java lib/mondrian_rest/formatters/excel.rb
mondrian-rest-1.0.2-java lib/mondrian_rest/formatters/excel.rb
mondrian-rest-1.0.1-java lib/mondrian_rest/formatters/excel.rb
mondrian-rest-1.0.0-java lib/mondrian_rest/formatters/excel.rb
mondrian-rest-0.7.9-java lib/mondrian_rest/formatters/excel.rb
mondrian-rest-0.7.8-java lib/mondrian_rest/formatters/excel.rb
mondrian-rest-0.7.7-java lib/mondrian_rest/formatters/excel.rb