Method: Spreadsheet::Excel::Reader#read_workbook

Defined in:
lib/spreadsheet/excel/reader.rb

#read_workbookObject



764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
# File 'lib/spreadsheet/excel/reader.rb', line 764

def read_workbook
  worksheet = nil
  previous_op = nil
  while tuple = get_next_chunk
    pos, op, len, work = tuple
    case op
    when @bof, :bof  # ●  BOF Type = worksheet (➜ 6.8)
      return
    when :eof        # ●  EOF ➜ 6.36
      postread_workbook
      return
    when :datemode   # ○  DATEMODE ➜ 6.25
      flag, _ = work.unpack 'v'
      if flag == 1
        @workbook.date_base = DateTime.new 1904, 1, 1
      else
        @workbook.date_base = DateTime.new 1899, 12, 31
      end
    when :continue   # ○  CONTINUE ➜ 6.22
      case previous_op
      when :sst      # ●  SST ➜ 6.96
        continue_sst work, pos, len
      end
    when :codepage   # ○  CODEPAGE ➜ 6.17
      read_codepage work, pos, len
    when :boundsheet # ●● BOUNDSHEET ➜ 6.12
      read_boundsheet work, pos, len
    when :xf         # ●● XF ➜ 6.115
      read_xf work, pos, len
    when :sst        # ○  Shared String Table ➜ 5.11
                     # ●  SST ➜ 6.96
      read_sst work, pos, len
      # TODO: implement memory-efficient sst handling, possibly in conjunction
      #       with EXTSST
    when :extsst     # ●  EXTSST ➜ 6.40
      read_extsst work, pos, len
    when :style      # ●● STYLE ➜ 6.99
      read_style work, pos, len
    when :format     # ○○ FORMAT (Number Format) ➜ 6.45
      read_format work, pos, len
    when :font       # ●● FONT ➜ 6.43
      read_font work, pos, len
    end
    previous_op = op unless op == :continue
  end
end