all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* how obtain automatic row numbers in a table starting after the second hline?
@ 2022-08-06 16:19 Uwe Brauer
  2022-08-07 11:21 ` Christian Moe
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Brauer @ 2022-08-06 16:19 UTC (permalink / raw)
  To: emacs-orgmode


Hi

I would like to obtain 
#+begin_src 

|  Nr |
|-----|
|     |
|-----|
| 574 |
| 575 |
|  .. |
| 680 |
#+end_src

I tried 
#+begin_src 

| Nr |
|----|
|  1 |
|----|
|  1 |
|  2 |
#+TBLFM: $1=vlen(@II$1..0);EN
#+end_src

or
#+begin_src 

|  Nr |
|-----|
| 573 |
|-----|
| 574 |
| 575 |
#+TBLFM: $1=@#-1+572
#+end_src

None worked, any ideas?

thanks

Uwe Brauer 
-- 
I strongly condemn Putin's war of aggression against the Ukraine.
I support to deliver weapons to Ukraine's military. 
I support the ban of Russia from SWIFT.
I support the EU membership of the Ukraine. 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how obtain automatic row numbers in a table starting after the second hline?
  2022-08-06 16:19 how obtain automatic row numbers in a table starting after the second hline? Uwe Brauer
@ 2022-08-07 11:21 ` Christian Moe
  2022-08-09  7:32   ` Uwe Brauer
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Moe @ 2022-08-07 11:21 UTC (permalink / raw)
  To: emacs-orgmode

Hi, Uwe,

Three ideas:

1. Since your solution depends on the row number (@#) in any case, your
   use case does not actually depend on hline-relative references, does
   it?  Then you can also assign to absolute row numbers, either by

   - assigning to the range rather than to the colum, which is not
     possible with hline relative references (the obvious
     @II$1..@>$1=@#-1+572 is not allowed), but with an absolute start
     reference it works:

     |  Nr |
     |-----|
     |     |
     |-----|
     | 574 |
     | 575 |
     | 576 |
     | 577 |
     #+TBLFM: @3$1..@>$1=@#-1+572

   - or assigning to the row first, then assigning the content between
     the hlines to that cell (perhaps a fragile solution).

     |  Nr |
     |-----|
     |     |
     |-----|
     | 574 |
     | 575 |
     | 576 |
     | 577 |
     #+TBLFM: $1=@#-1+572::@2$1=string("")

2. Use a conditional to avoid changing the cell between the hlines, e.g.:

   |  Nr |
   |-----|
   | foo |
   |-----|
   | 574 |
   | 575 |
   | 576 |
   | 577 |
   #+TBLFM: $1=if(@# < 3, @0$1, @#+571)

   Here, I use @0$1 to replace that cell with itself. If the cell is empty,
   this evaluates as 0, so if you want an empty string, use string("")
   instead of @0$1.

3. Add a first column with special marking characters (see Org manual:
   Spreadsheet: Advanced features), leaving empty the cell between the
   hlines so it won't get recalculated.

   |   |  Nr |
   |---+-----|
   |   |     |
   |---+-----|
   | * | 574 |
   | * | 575 |
   | * | 576 |
   | * | 577 |
   #+TBLFM: $2=@#-1+572

Yours,
Christian

Uwe Brauer writes:

> Hi
>
> I would like to obtain
> #+begin_src
>
> |  Nr |
> |-----|
> |     |
> |-----|
> | 574 |
> | 575 |
> |  .. |
> | 680 |
> #+end_src
>
> I tried
> #+begin_src
>
> | Nr |
> |----|
> |  1 |
> |----|
> |  1 |
> |  2 |
> #+TBLFM: $1=vlen(@II$1..0);EN
> #+end_src
>
> or
> #+begin_src
>
> |  Nr |
> |-----|
> | 573 |
> |-----|
> | 574 |
> | 575 |
> #+TBLFM: $1=@#-1+572
> #+end_src
>
> None worked, any ideas?
>
> thanks
>
> Uwe Brauer


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how obtain automatic row numbers in a table starting after the second hline?
  2022-08-07 11:21 ` Christian Moe
@ 2022-08-09  7:32   ` Uwe Brauer
  2022-08-10 20:28     ` Christian Moe
  0 siblings, 1 reply; 4+ messages in thread
From: Uwe Brauer @ 2022-08-09  7:32 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 503 bytes --]

>>> "CM" == Christian Moe <mail@christianmoe.com> writes:

> Hi, Uwe,
> Three ideas:

Wow, thanks a lot of all these solutions

I am using the new ods exporter found in 

git@github.com:kjambunathan/org-mode-ox-odt.git

And the first and the last solution work in the sense that LO can open the exported ods file while the second (string) and third (conditional) result in ods file that cannot be opened.

Given my use case, I think I will take the first solution, thanks

Again

Uwe 

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how obtain automatic row numbers in a table starting after the second hline?
  2022-08-09  7:32   ` Uwe Brauer
@ 2022-08-10 20:28     ` Christian Moe
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Moe @ 2022-08-10 20:28 UTC (permalink / raw)
  To: emacs-orgmode, Uwe Brauer


Hi, Uwe,

I also get an error when exporting my suggestions to ODT with the
official ODT exporter, but it's not because of the solutions. They
should all be fine, but anyway, it's enough that one of them works for
you.

Rather, the exporter seems to be confused by the way I mixed tables into
a list structure, which leads it to add a </text:list-header> tag
without a preceding opening tag, invalidating the XML. If I can pin down
a minimal example, I'll see about reporting it as a bug in the ODT
exporter (possibly the structure I used is not meant to be allowed, but
it seems to work OK in HTML and LaTeX export).

Yours,
Christian

Uwe Brauer writes:

>>>> "CM" == Christian Moe <mail@christianmoe.com> writes:
>
>> Hi, Uwe,
>> Three ideas:
>
> Wow, thanks a lot of all these solutions
>
> I am using the new ods exporter found in
>
> git@github.com:kjambunathan/org-mode-ox-odt.git
>
> And the first and the last solution work in the sense that LO can open the exported ods file while the second (string) and third (conditional) result in ods file that cannot be opened.
>
> Given my use case, I think I will take the first solution, thanks
>
> Again
>
> Uwe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-08-10 20:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-06 16:19 how obtain automatic row numbers in a table starting after the second hline? Uwe Brauer
2022-08-07 11:21 ` Christian Moe
2022-08-09  7:32   ` Uwe Brauer
2022-08-10 20:28     ` Christian Moe

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.