Sha256: 92e65258f0e97e4c88750f21c646214f2b49bbdc92f4dc10b8032d2dc37907b8

Contents?: true

Size: 1.08 KB

Versions: 12

Compression:

Stored size: 1.08 KB

Contents

require 'spreadsheet/encodings'

module Spreadsheet
  module Excel
##
# Shared String Table Entry
class SstEntry
  include Spreadsheet::Encodings
  attr_accessor :chars, :phonetic, :richtext, :flags, :available,
                :continued_chars, :wide
  def initialize opts = {}
    @offset = opts[:offset]
    @ole    = opts[:ole]
    @reader = opts[:reader]
    @continuations = []
  end
  ##
  # Access the contents of this Shared String
  def content
    @content or begin
      data = nil
      data = @ole[@offset, @available]
      content, _ = @reader.read_string_body data, @flags, @available, @wide
      @continuations.each do |offset, len|
        @reader.continue_string(@ole[offset,len], [content, @chars])
      end
      content = client content, 'UTF-16LE'
      if @reader.memoize?
        @content = content
      end
      content
    end
  end
  ##
  # Register the offset of a String continuation
  def continue offset, size, chars
    @continued_chars -= chars
    @continuations.push [offset, size]
  end
  def continued? # :nodoc:
    @continued_chars > 0
  end
end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
spreadsheet-0.6.1.1 lib/spreadsheet/excel/sst_entry.rb
spreadsheet-0.6.1.3 lib/spreadsheet/excel/sst_entry.rb
spreadsheet-0.6.1.2 lib/spreadsheet/excel/sst_entry.rb
spreadsheet-0.6.1.8 lib/spreadsheet/excel/sst_entry.rb
spreadsheet-0.6.3 lib/spreadsheet/excel/sst_entry.rb
spreadsheet-0.6.1.6 lib/spreadsheet/excel/sst_entry.rb
spreadsheet-0.6.1.4 lib/spreadsheet/excel/sst_entry.rb
spreadsheet-0.6.1.5 lib/spreadsheet/excel/sst_entry.rb
spreadsheet-0.6.1.9 lib/spreadsheet/excel/sst_entry.rb
spreadsheet-0.6.2.1 lib/spreadsheet/excel/sst_entry.rb
spreadsheet-0.6.1.7 lib/spreadsheet/excel/sst_entry.rb
spreadsheet-0.6.2 lib/spreadsheet/excel/sst_entry.rb