Class: Oxcelix::RawWorkbook

Inherits:
Workbook show all
Defined in:
lib/oxcelix/workbook.rb

Overview

RawWorkbook is a Workbook that contains the raw values of the original Excel cells instead of Cell objects. The values are taken from the Sheet arrays by running the #Cell::value method.

Constant Summary

Constants included from Numformats

Numformats::Dtmap, Numformats::Formatarray

Instance Attribute Summary

Attributes inherited from Workbook

#sheets

Instance Method Summary collapse

Methods inherited from Workbook

#commentsrel, #initialize, #matrixto, #mergevalues, #mkcomments, #open, #parse, #sheet_collection, #sheetdata, #shstrings, #unpack

Methods included from Numformats

#add_custom_formats, #datetime, #numeric

Methods included from Workbookhelper

#[]

Methods included from Cellhelper

#x, #y

Constructor Details

This class inherits a constructor from Oxcelix::Workbook

Instance Method Details

#buildsheet(sheet, options) ⇒ Object (private)

A class that represents an Excel workbook. By default, it will open the excel file, and convert it to a collection of Matrix objects


331
332
333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/oxcelix/workbook.rb', line 331

def buildsheet(sheet, options)
  ydiff, xdiff = 0,0
  if !options[:paginate].nil?
    ydiff = options[:paginate][0] * (options[:paginate][1]-1)
  elsif !options[:cellrange].nil?
    xdiff = x(options[:cellrange].begin)
    ydiff = y(options[:cellrange].begin)
  end
  m=Sheet.build(sheet[:cells].last.y+1-ydiff, sheet[:cells].last.x+1-xdiff) {nil}
  sheet[:cells].each do |c|
    m[c.y-ydiff, c.x-xdiff] = c.value
  end
  return m
end