| Class | Spreadsheet::Excel::Workbook |
| In: |
lib/spreadsheet/excel.rb
lib/spreadsheet/excel/workbook.rb |
| Parent: | Object |
| BIFF_VERSIONS | = | { 0x000 => 2, 0x007 => 2, 0x200 => 2, 0x300 => 3, 0x400 => 4, 0x500 => 5, 0x600 => 8, } |
| VERSION_STRINGS | = | { 0x600 => 'Microsoft Excel 97/2000/XP', 0x500 => 'Microsoft Excel 95', } |
| bof | [RW] | |
| date_base | [W] | |
| ole | [RW] |
# File lib/spreadsheet/excel/workbook.rb, line 34
34: def initialize *args
35: super
36: enc = 'UTF-16LE'
37: if RUBY_VERSION >= '1.9'
38: enc = Encoding.find enc
39: end
40: @encoding = enc
41: @version = 0x600
42: @sst = []
43: end
# File lib/spreadsheet/excel/workbook.rb, line 30
30: def Workbook.open io, opts = {}
31: @reader = Reader.new opts
32: @reader.read io
33: end
# File lib/spreadsheet/excel/workbook.rb, line 44
44: def add_shared_string str
45: @sst.push str
46: end
# File lib/spreadsheet/excel.rb, line 28
28: def add_worksheet name
29: if name.is_a? String
30: create_worksheet :name => name
31: else
32: super
33: end
34: end
# File lib/spreadsheet/excel/workbook.rb, line 47
47: def add_worksheet worksheet
48: @changes.store :boundsheets, true
49: super
50: end
# File lib/spreadsheet/excel/workbook.rb, line 51
51: def biff_version
52: case @bof
53: when 0x009
54: 2
55: when 0x209
56: 3
57: when 0x409
58: 4
59: else
60: BIFF_VERSIONS.fetch(@version) { raise "Unkown BIFF_VERSION '#@version'" }
61: end
62: end
# File lib/spreadsheet/excel/workbook.rb, line 63
63: def date_base
64: @date_base ||= DateTime.new 1899, 12, 31
65: end
# File lib/spreadsheet/excel/workbook.rb, line 66
66: def shared_string idx
67: @sst[idx.to_i].content
68: end
# File lib/spreadsheet/excel/workbook.rb, line 72
72: def uninspect_variables
73: super.push '@sst', '@offsets', '@changes'
74: end