# File lib/spreadsheet/worksheet.rb, line 273
   def write_string(row, col, str, format)
      record = 0x0204
      length = 0x0008 + str.length

      xf_index = XF(row, col, format)

      strlen = str.length

      raise MaxSizeError if row >= RowMax
      raise MaxSizeError if col >= ColMax

      @dim_rowmin = row if row < @dim_rowmin
      @dim_rowmax = row if row > @dim_rowmax
      @dim_colmin = col if col < @dim_colmin
      @dim_colmax = col if col > @dim_colmax

      # Truncate strings over 255 characters
      if strlen > StrMax
         str    = str[0..StrMax-1]
         length = 0x0008 + StrMax
         strlen = StrMax
      end

      header = [record, length].pack("vv")
      data   = [row, col, xf_index, strlen].pack("vvvv")

      append(header, data, str)
   end