[NTG-context] xtable headers and handlecsv loop

Pablo Rodriguez oinos at gmx.es
Fri Apr 3 13:34:28 CEST 2020


On 4/3/20 12:31 PM, Pablo Rodriguez wrote:
> On 4/3/20 11:57 AM, Geert Dobbels wrote:
>> [...]
>> So in my second \doloopfromto I give the second argument a number
>> high enough to be sure it reads all the lines. It works fine, but I
>> would like to know if there is a way to read the number of lines in
>> the csv file to use the exact number of lines, instead of guessing.
>
> If \numrows doesn’t fit your needs, please provide a CSV file with fake
> data. I cannot guess why a second loop might be required.

Hi Geert,

this approach is simpler:

    \starttext
    \startxtable
    \startxtablehead[head]
    \doloopif{\lineno}{<}{2}{\getbuffer[loop]}
    \stopxtablehead
    \startxtablebody
    \doloopif{\lineno}{>}{1}{\getbuffer[loop]}
    \stopxtablebody
    \stopxtable
    \stoptext

Only loop header with CSV lines numbered below 2, and loop boody with
CSV lines numbered above 1.

Pablo
--
http://www.ousia.tk


More information about the ntg-context mailing list