Class Spreadsheet::Column
In: lib/spreadsheet/column.rb
Parent: Object
Column Format Row Font Enumerable Worksheet\n[lib/spreadsheet/excel.rb\nlib/spreadsheet/worksheet.rb] Link Workbook Workbook\n[lib/spreadsheet/excel.rb\nlib/spreadsheet/excel/workbook.rb] SstEntry String Row Array Worksheet ExcelCompatibleWorkbook Format Worksheet Workbook DelegateClassSpreadsheet::Format Writer Compatibility Formula Reader\n[lib/parseexcel/parseexcel.rb\nlib/spreadsheet/excel/reader.rb\nlib/spreadsheet/excel/reader/biff5.rb\nlib/spreadsheet/excel/reader/biff8.rb] Error lib/spreadsheet/excel.rb lib/spreadsheet/link.rb lib/spreadsheet/formula.rb lib/spreadsheet/workbook.rb lib/spreadsheet/font.rb lib/spreadsheet/column.rb lib/spreadsheet/format.rb lib/spreadsheet/writer.rb lib/spreadsheet/row.rb Encodings lib/spreadsheet/excel.rb lib/spreadsheet/excel/row.rb lib/spreadsheet/excel/reader/biff5.rb lib/spreadsheet/excel/worksheet.rb lib/spreadsheet/excel/sst_entry.rb lib/spreadsheet/excel/error.rb lib/spreadsheet/excel/workbook.rb lib/spreadsheet/excel/writer/format.rb lib/spreadsheet/excel/writer/workbook.rb lib/spreadsheet/excel/writer/worksheet.rb Biff8 Writer Biff5 Biff8 Internals Offset Excel Datatypes ParseExcel Compatibility Spreadsheet dot/m_34_0.png

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.

Methods

default_format=   each   new   updater  

Included Modules

Datatypes Enumerable

Attributes

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

Public Class methods

[Source]

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

[Source]

    # File lib/spreadsheet/column.rb, line 21
21:       def updater *keys
22:         keys.each do |key|
23:           unless instance_methods.include? "unupdated_#{key}="
24:             alias_method "unupdated_#{key}=""unupdated_#{key}=", "#{key}=""#{key}="
25:             define_method "#{key}=" do |value|
26:               send "unupdated_#{key}=", value
27:               @worksheet.column_updated @idx, self if @worksheet
28:               value
29:             end
30:           end
31:         end
32:       end

Public Instance methods

Set the default Format for Cells in this Column.

[Source]

    # File lib/spreadsheet/column.rb, line 52
52:     def default_format= format
53:       @worksheet.add_format format if @worksheet
54:       @default_format = format
55:       @worksheet.column_updated @idx, self if @worksheet
56:       format
57:     end

Iterate over all cells in this column.

[Source]

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

[Validate]