This is very similar (if not identical) to the basic {TABLE} code over on minmaxboards. Prime32 was able to implement fancier tables, with row/cell shading, column spanning, sortable tables, etc. Maybe some code merging might help?