# File lib/ansi/table.rb, line 58
    def to_s #(fit=false)
      #row_count = table.size
      #col_count = table[0].size

      max = max_columns(fit)

      div = dividing_line
      top = div #.gsub('+', ".")
      bot = div #.gsub('+', "'")

      body = []
      table.each_with_index do |row, r|
         body_row = []
         row.each_with_index do |cell, c|
           t = cell_template(max[c])
           s = t % cell.to_s
           body_row << apply_format(s, cell, c, r)
         end
         body << "| " + body_row.join(' | ') + " |"
      end

      if border
        body = body.join("\n#{div}\n")
      else
        body = body.join("\n")
      end

      "#{top}\n#{body}\n#{bot}\n"
    end