Am Thu, Nov 18, 2021 at 12:56:33PM +0100 schrieb Hans Hagen:
> On 11/18/2021 10:29 AM, juh via ntg-context wrote:
> > Hi all,
> > 
> > is there a parameter to have multiple lines in a cell in a spreadsheettable?
> see end of m-spreadsheet ... they are just natural tables

I found this code on the wiki

% mode=mkiv
\setuppapersize[A5]
\bTABLE
\setupTABLE[c][each][alignmentcharacter={number->.},aligncharacter=yes,align=middle]
\bTABLEhead
\bTR
\bTH Same-Width Prefix \eTH \bTH Varying-Width Prefix \eTH
\bTH Same-Width Suffix \eTH \bTH Varying-Width Suffix \eTH
\eTR
\eTABLEhead
\bTABLEbody
\bTR \bTD  \$1.00 \eTD \bTD    \$1.00 \eTD \bTD  1.00\% \eTD \bTD  1.00\%   
\eTD \eTR
\bTR \bTD \$10.00 \eTD \bTD \$\$10.00 \eTD \bTD 10.00\% \eTD \bTD 10.00\%\% 
\eTD \eTR
\bTR \bTD  \$1.0  \eTD \bTD    \$1.0  \eTD \bTD  1.0\%  \eTD \bTD  1.0\%    
\eTD \eTR
\bTR \bTD \$10.0  \eTD \bTD \$\$10.0  \eTD \bTD 10.0\%  \eTD \bTD 10.0\%\%  
\eTD \eTR
\eTABLEbody
\eTABLE

It sets the text of bTH like p{4cm} in LaTeX in several lines.

But this does not work with my invoice code:

\startspreadsheettable[test][frame=off]
\setupTABLE[c][each][alignmentcharacter={number->.},aligncharacter=yes,align=middle]
\startrow[topframe=off,bottomframe=on]
\startcell[align=flushleft] "Anz" \stopcell
\startcell[align=flushleft, width=9cm] "Beschreibung" \stopcell
\startcell[align=flushleft] "MwSt" \stopcell
\startcell[align=flushright] "Einzeln" \stopcell
\startcell[align=flushright] "Gesamt" \stopcell    
\stoprow

$for(positions)$
\startrow
\startcell[align=center] @ "0.2f h" $it.stunden$ \stopcell
\startcell[align=flushleft] "$it.name$" \stopcell  %<-- this cell should
be like p{4cm}
\startcell[align=flushright] @ "0.2f \percent" $it.mwst$ \stopcell
\startcell[align=flushright] @ "0.2f €" $it.stundensatz$ \stopcell
\startcell[align=flushright] @ "0.2f €" (A[row] * D[row]) \stopcell    
\stoprow
$endfor$

\startrow[topframe=on]
\startcell[align=flushleft] " " \stopcell
\startcell[align=flushleft, style=bold] "Gesamt netto" \stopcell
\startcell[align=flushleft] " " \stopcell
\startcell[align=flushleft] " " \stopcell
\startcell[align=flushright, style=bold] @ "0.2f €" sum(E) \stopcell
\stoprow

\startrow[topframe=off]
\startcell[align=flushleft] " " \stopcell
\startcell[align=flushleft] "Mehrwertsteuer" \stopcell
\startcell[align=flushleft] " " \stopcell
\startcell[align=flushleft] " " \stopcell
\startcell[align=flushright] @ "0.2f €" 0.19 * E[row-1] \stopcell
\stoprow

\startrow[topframe=off]
\startcell[align=flushleft] " " \stopcell
\startcell[align=flushleft, style=bold] "Gesamtsumme" \stopcell
\startcell[align=flushleft] " " \stopcell
\startcell[align=flushleft] " " \stopcell    
\startcell[align=flushright, style=bold] @ "0.2f €" E[row-1]+E[row-2] \stopcell
\stoprow
\stopspreadsheettable

The key between $ are variables which get filled by pandoc.

Attachment: signature.asc
Description: PGP signature

___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to