Version 3 of report

Updated 2001-11-12 17:54:16

Documentation can be found at http://tcllib.sourceforge.net/doc/report.html


Has anyone done anything simple with this command? I'm having problems figuring where to start.


 package require csv
 package require cmdline
 package require report
 package require struct

 ... open a channel to a a CSV file, with default separator (comma)

 struct::matrix::matrix    m
 csv::read2matrix $channel m
 report::report         r [m columns] ; # (*)
 r printmatrix2channel  m stdout

This should print the CSV file to stdout, auto-formatted so that each column is wide enough to hold the longest value of that column. No visual frills like header, footer or column separators.


For output as HTML table add

 ::report::defstyle html {} {
    set c  [columns]
     set cl $c ; incr cl -1
     data set "<tr> [split [string repeat " " $cl] ""] </tr>"
     for {set col 0} {$col < $c} {incr col} {
         pad $col left  "<td>"
         pad $col right "</td>"
     }
     return
 }

somewhere before the creation of the report and use

 report::report r [m columns] style html

to create the report object, see (*) above.


Category Package, subset Tcllib