class Spreadsheet::Excel::Worksheet

Excel-specific Worksheet methods. These are mostly pertinent to the Excel reader, and to recording changes to the Worksheet. You should have no reason to use any of these.

Attributes

guts[R]
notes[R]
offset[R]
ole[R]

Public Class Methods

new(opts = {}) click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 15
def initialize opts = {}
  @row_addresses = nil
  super
  @offset, @ole, @reader = opts[:offset], opts[:ole], opts[:reader]
  @dimensions = nil
  @links = {}
  @guts = {}
  @notes = {}
end

Public Instance Methods

add_note(row, column, note) click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 27
def add_note row, column, note
  @notes.store [row, column], note
end
column(idx) click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 30
def column idx
  ensure_rows_read
  super
end
date_base() click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 34
def date_base
  @workbook.date_base
end
each(*args) click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 45
def each *args
  ensure_rows_read
  super
end
ensure_rows_read() click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 49
def ensure_rows_read
  return if @row_addresses
  @dimensions = nil
  @row_addresses = []
  @reader.read_worksheet self, @offset if @reader
end
margins() click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 37
def margins
  ensure_rows_read
  super
end
pagesetup() click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 41
def pagesetup
  ensure_rows_read
  super
end
row(idx) click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 55
def row idx
  @rows[idx] or begin
    ensure_rows_read
    if addr = @row_addresses[idx]
      row = @reader.read_row self, addr
      [:default_format, :height, :outline_level, :hidden, ].each do |key|
        row.send "unupdated_#{key}=", addr[key]
      end
      row.worksheet = self
      row
    else
      Row.new self, idx
    end
  end
end
row_updated(idx, row) click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 73
def row_updated idx, row
  res = super
  @workbook.changes.store self, true
  @workbook.changes.store :boundsheets, true
  @changes.store idx, true
  @changes.store :dimensions, true
  res
end
rows() click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 70
def rows
  self.to_a
end
set_row_address(idx, opts) click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 81
def set_row_address idx, opts
  @offsets.store idx, opts[:row_block]
  @row_addresses[idx] = opts
end
shared_string(idx) click to toggle source
# File lib/spreadsheet/excel/worksheet.rb, line 85
def shared_string idx
  @workbook.shared_string idx
end