Hi,

I try currently to write a table with a repeated header on all pages and
rules above and below the header
and another rule below the table on all pages. I tried this now with all
tables in ConTeXt but I can't the
desired result from any of them.

Tabulate has problems with rule below the header and did not support
repeated footers.

TaBlE has problems with the spacing of his rows below the header and at the
bottom of the tables,
it has also a problem with the spacing from the rule at the bottom.

Natural Tables allow me to put a rule above and below the header but I'm
unable to get rule at last row
on every page, the "last" key for rows use always the last row of the hole
table.

I played also a little bit with textbackground but I have a few problems
with the results, the background
has always the width of the current textwidth and it takes always the
topskip into account.

What it tried so far is the following code:


\setuppapersize[A7,landscape][A7,landscape]
\setuplayout[lines=5]

\starttext

\tracetablestrue
\setuptables[split=repeat]

\starttablehead
\HL
\NC Row 1 \NC Row 2 \NC Row 3 \NC\AR
\HL
\stoptablehead

\starttabletail
\HL
\stoptabletail

\starttable[|l|l|l|]
\NC Text \NC Text \NC Text \NC\AR
\NC Text \NC Text \NC Text \NC\AR
\NC Text \NC Text \NC Text \NC\AR
\NC Text \NC Text \NC Text \NC\AR
\NC Text \NC Text \NC Text \NC\AR
\NC Text \NC Text \NC Text \NC\AR
\stoptable

\page

\startbuffer[tabulate]
\starttabulatehead
\HL
\NC Row 1 \NC Row 2 \NC Row 3 \NC\NR
\HL
\stoptabulatehead

\starttabulatetail
\HL
\stoptabulatetail

\starttabulate[|l|l|l|]
\NC Text \NC Text \NC Text \NC\NR
\NC Text \NC Text \NC Text \NC\NR
\NC Text \NC Text \NC Text \NC\NR
\NC Text \NC Text \NC Text \NC\NR
\NC Text \NC Text \NC Text \NC\NR
\NC Text \NC Text \NC Text \NC\NR
\stoptabulate
\stopbuffer

\getbuffer[tabulate]

\page

\setuptabulate[header=repeat]

\getbuffer[tabulate]

\page

\newconditional\tabulaterepeatfoot

\settrue\tabulaterepeatfoot

\def\dosplittabulatebox#1%
  {\resettsplit
   \def\tsplitminimumfreelines{2}%
   \def\tsplitminimumfreespace{0pt}%
   \setbox\tsplitcontent\box#1%
   \ifcase\tabulaterepeathead\or
     \setbox\tsplithead\vsplit\tsplitcontent to 3\lineheight
     \setbox\tsplithead\vbox{\unvbox\tsplithead}%
   \or
     \setbox\tsplithead\vbox{\hbox{\strut\tabulateparameter\c!title}}%
   \fi
   \ifcase\tabulaterepeatfoot
     %\setbox\tsplittail\vsplit\tsplitcontent to \lineheight
     %\setbox\tsplittail\vbox{\unvbox\tsplittail}%
     \setbox\tsplittail\vbox{\color[orange]{\hrule}}%
   \fi
   \handletsplit}

\def\fulltabulatecontent
  {\tabulateheadcontent
   \tabulatecontent
   \ifcase\tabulaterepeatfoot\else
     \tabulatetailcontent
   \fi
   \removefunnytabulateline}

%\tracetabulatetrue

\getbuffer[tabulate]

\page

%\traceTABLEtrue
\setupTABLE[split=repeat,frame=off]
\setupTABLE[header][topframe=on,bottomframe=on]
\setupTABLE[row][last][bottomframe=on]

\bTABLE
\bTABLEhead
\bTR\bTH Row 1 \eTH\bTH Row 2 \eTH\bTH Row 3 \eTH\eTR
\eTABLEhead
\bTABLEfoot
\bTR\bTD Row 1 \eTD\bTD Row 2 \eTD\bTD Row 3 \eTD\eTR
\eTABLEfoot
\bTABLEbody
\bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR
\bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR
\bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR
\bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR
\bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR
\bTR\bTD Text \eTD\bTD Text \eTD\bTD Text \eTD\eTR
\eTABLEbody
\eTABLE

\stoptext

I will also show you what I tried to get with textbackgrounds.

\setuppapersize[A7,landscape][A7,landscape]
\setuplayout[lines=5]
\setupcolors[state=start]

\startuseMPgraphic{tableback}
pickup pencircle scaled 1pt;
path p;
p = (multipars[1]);
draw p withcolor red;
\stopuseMPgraphic

\definetextbackground
  [mytab]
  [location=paragraph,
   width=local,
   mp=tableback]

\starttext

%\topskip=0pt

\setuptabulate
  [before={\starttextbackground[mytab]},
   after=\stoptextbackground]

\starttabulatehead
\HL
\NC Row 1 \NC Row 2 \NC Row 3 \NC\NR
\HL
\stoptabulatehead

\starttabulatetail
\HL
\stoptabulatetail

\starttabulate[|l|l|l|]
\NC Text \NC Text \NC Text \NC\NR
\NC Text \NC Text \NC Text \NC\NR
\NC Text \NC Text \NC Text \NC\NR
\NC Text \NC Text \NC Text \NC\NR
\NC Text \NC Text \NC Text \NC\NR
\NC Text \NC Text \NC Text \NC\NR
\stoptabulate

\stoptext

Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to