# File lib/kirbybase.rb, line 3755
    def to_report(recs_per_page=0, print_rec_sep=false)
        result = collect { |r| @filter.collect {|f| r.send(f)} }

        # How many records before a formfeed.

        delim = ' | '

        # columns of physical rows

        columns = [@filter].concat(result).transpose

        max_widths = columns.collect { |c|
            c.max { |a,b| a.to_s.length <=> b.to_s.length }.to_s.length
        }

        row_dashes = '-' * (max_widths.inject {|sum, n| sum + n} +
         delim.length * (max_widths.size - 1))

        justify_hash = { :String => :ljust, :Integer => :rjust,
         :Float => :rjust, :Boolean => :ljust, :Date => :ljust,
         :Time => :ljust, :DateTime => :ljust }

        header_line = @filter.zip(max_widths, @filter.collect { |f|
            @filter_types[@filter.index(f)] }).collect { |x,y,z|
                 x.to_s.send(justify_hash[z], y) }.join(delim)

        output = ''
        recs_on_page_cnt = 0

        result.each do |row|
            if recs_on_page_cnt == 0
                output << header_line + "\n" << row_dashes + "\n"
            end

            output << row.zip(max_widths, @filter.collect { |f|
                @filter_types[@filter.index(f)] }).collect { |x,y,z|
                    x.to_s.send(justify_hash[z], y) }.join(delim) + "\n"

            output << row_dashes + '\n' if print_rec_sep
            recs_on_page_cnt += 1

            if recs_per_page > 0 and (recs_on_page_cnt ==
             num_recs_per_page)
                output << '\f'
                recs_on_page_count = 0
            end
        end
        return output
    end