ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: juh via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: juh <juh+ntg-context@mailbox.org>
Subject: Re: Multiline cell in spreadsheettable
Date: Thu, 18 Nov 2021 17:07:41 +0100	[thread overview]
Message-ID: <YZZ6TatDwSdQOk28@sokrates> (raw)
In-Reply-To: <783e8562-7665-0d96-d0d4-f9ccd3e6515f@xs4all.nl>


[-- Attachment #1.1: Type: text/plain, Size: 2947 bytes --]

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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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	other threads:[~2021-11-18 16:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18  9:29 juh via ntg-context
2021-11-18 11:56 ` Hans Hagen via ntg-context
2021-11-18 16:07   ` juh via ntg-context [this message]
2021-11-18 18:08     ` Hans Hagen via ntg-context
2021-11-19  7:48       ` juh via ntg-context
2021-11-19  8:19         ` Henning Hraban Ramm via ntg-context
2021-11-19 10:25           ` juh via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YZZ6TatDwSdQOk28@sokrates \
    --to=ntg-context@ntg.nl \
    --cc=juh+ntg-context@mailbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).