### Home Classes Methods

### In Files

- lib/spreadsheet/column.rb

### Parent

Object

### Methods

- ::new
- ::updater
- #default_format=
- #each

### Included Modules

- Spreadsheet::Datatypes
- Enumerable

### Files

- LICENSE.txt
- Manifest.txt

### Class/Module Index

Quicksearch

- Spreadsheet
- Spreadsheet::Column
- Spreadsheet::Compatibility
- Spreadsheet::Datatypes
- Spreadsheet::Encodings
- Spreadsheet::Excel
- Spreadsheet::Excel::Error
- Spreadsheet::Excel::ExcelCompatibleWorkbook
- Spreadsheet::Excel::Internals
- Spreadsheet::Excel::Internals::Biff5
- Spreadsheet::Excel::Internals::Biff8
- Spreadsheet::Excel::Offset
- Spreadsheet::Excel::Password
- Spreadsheet::Excel::Reader
- Spreadsheet::Excel::Reader::Biff5
- Spreadsheet::Excel::Rgb
- Spreadsheet::Excel::Row
- Spreadsheet::Excel::SstEntry
- Spreadsheet::Excel::Workbook
- Spreadsheet::Excel::Worksheet
- Spreadsheet::Font
- Spreadsheet::Format
- Spreadsheet::Formula
- Spreadsheet::Helpers
- Spreadsheet::Link
- Spreadsheet::Note
- Spreadsheet::NoteObject
- Spreadsheet::ParseExcel
- Spreadsheet::ParseExcel::Worksheet
- Spreadsheet::ParseExcel::Worksheet::Cell
- Spreadsheet::Row
- Spreadsheet::Workbook
- Spreadsheet::Worksheet
- Spreadsheet::Writer

No matching classes.

# Spreadsheet::Column

The Column class. Encapsulates column-formatting and width, and provides a means to iterate over all cells in a column.

Useful Attributes:

width | The width in characters (in respect to the '0' character of the Worksheet's default Font). Float values are permitted, for Excel the available Precision is at 1/256 characters.
default_format | The default Format for cells in this column (applied if there is no explicit Cell Format and no default Row format for the Cell).
hidden | The Column is hidden.
collapsed | The Column is collapsed.
outline_level | Outline level of the column.

### Attributes

default_format[R]
idx[R]
width[RW]
worksheet[RW]

### Public Class Methods

new(idx, format, opts={}) click to toggle source

    # File lib/spreadsheet/column.rb, line 41
    def initialize idx, format, opts={}
      @worksheet = nil
      @idx = idx
      opts[:width] ||= 10
      opts.each do |key, value|
        self.send "#{key}=", value
      end
      self.default_format = format
    end

updater(*keys) click to toggle source

    # File lib/spreadsheet/column.rb, line 21
    def updater *keys
      keys.each do |key|
        unless instance_methods.include? "unupdated_#{key}="
          alias_method :"unupdated_#{key}=", :"#{key}="
          define_method "#{key}=" do |value|
            send "unupdated_#{key}=", value
            @worksheet.column_updated @idx, self if @worksheet
            value
          end
        end
      end
    end

### Public Instance Methods

default_format=(format) click to toggle source

Set the default Format for Cells in this Column.

    # File lib/spreadsheet/column.rb, line 52
    def default_format= format
      @worksheet.add_format format if @worksheet
      @default_format = format
      @worksheet.column_updated @idx, self if @worksheet
      format
    end

each() click to toggle source

Iterate over all cells in this column.

    # File lib/spreadsheet/column.rb, line 60
    def each
      @worksheet.each do |row|
        yield row[idx]
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.