### Home Classes Methods

### In Files

- lib/spreadsheet/excel.rb
- lib/spreadsheet/excel/workbook.rb

### Parent

Spreadsheet::Workbook

### Methods

- ::new
- ::open
- #add_shared_string
- #add_worksheet
- #biff_version
- #date_base
- #shared_string
- #sst_size
- #uninspect_variables
- #version_string

### Included Modules

- Spreadsheet::Encodings
- Spreadsheet::Excel::Offset

### 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::Excel::Workbook

Excel-specific Workbook methods. These are mostly pertinent to the Excel reader. You should have no reason to use any of these.

### Constants

BIFF_VERSIONS
VERSION_STRINGS

### Attributes

bof[RW]
date_base[W]
ole[RW]

### Public Class Methods

new(*args) click to toggle source

    # File lib/spreadsheet/excel/workbook.rb, line 34
    def initialize *args
      super
      enc = 'UTF-16LE'
      if RUBY_VERSION >= '1.9'
        enc = Encoding.find enc
      end
      @encoding = enc
      @version = 0x600
      @sst = []
    end

open(io, opts = {}) click to toggle source

    # File lib/spreadsheet/excel/workbook.rb, line 30
    def Workbook.open io, opts = {}
      @reader = Reader.new opts
      @reader.read io
    end

### Public Instance Methods

add_shared_string(str) click to toggle source

    # File lib/spreadsheet/excel/workbook.rb, line 44
    def add_shared_string str
      @sst.push str
    end

add_worksheet(name) click to toggle source

    # File lib/spreadsheet/excel.rb, line 27
    def add_worksheet name
      if name.is_a? String
        create_worksheet :name => name
      else
        super
      end
    end

biff_version() click to toggle source

    # File lib/spreadsheet/excel/workbook.rb, line 51
    def biff_version
      case @bof
      when 0x009
        2
      when 0x209
        3
      when 0x409
        4
      else
        BIFF_VERSIONS.fetch(@version) { raise "Unkown BIFF_VERSION '#@version'" }
      end
    end

date_base() click to toggle source

    # File lib/spreadsheet/excel/workbook.rb, line 63
    def date_base
      @date_base ||= DateTime.new 1899, 12, 31
    end

shared_string(idx) click to toggle source

    # File lib/spreadsheet/excel/workbook.rb, line 66
    def shared_string idx
      @sst[idx.to_i].content
    end

sst_size() click to toggle source

    # File lib/spreadsheet/excel/workbook.rb, line 69
    def sst_size
      @sst.size
    end

uninspect_variables() click to toggle source

    # File lib/spreadsheet/excel/workbook.rb, line 72
    def uninspect_variables
      super.push '@sst', '@offsets', '@changes'
    end

version_string() click to toggle source

    # File lib/spreadsheet/excel/workbook.rb, line 75
    def version_string
      client VERSION_STRINGS.fetch(@version, "Unknown"), 'UTF-8'
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.