From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: row and col spaning in table? Date: Fri, 20 Aug 2010 16:08:17 +0200 Message-ID: <6E6093CC-E9DD-437A-A9C0-8A2F86225902@gmail.com> References: <83bp9sqdec.fsf@yahoo.it> <4C6B8C90.5010109@christianmoe.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=52042 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OmSGj-00047S-JM for emacs-orgmode@gnu.org; Fri, 20 Aug 2010 10:08:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OmSGc-0007k6-PO for emacs-orgmode@gnu.org; Fri, 20 Aug 2010 10:08:24 -0400 Received: from mail-ey0-f169.google.com ([209.85.215.169]:62758) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OmSGc-0007jk-GF for emacs-orgmode@gnu.org; Fri, 20 Aug 2010 10:08:22 -0400 Received: by eyg7 with SMTP id 7so2242997eyg.0 for ; Fri, 20 Aug 2010 07:08:21 -0700 (PDT) In-Reply-To: <4C6B8C90.5010109@christianmoe.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: mail@christianmoe.com Cc: David Hajage , emacs-orgmode@gnu.org On Aug 18, 2010, at 9:32 AM, Christian Moe wrote: > Giovanni Ridolfi wrote: >> David Hajage writes: >>> and I was wondering if row and col spaning was possible? >> Currently not. But, if this is your case, you should use the >> table.el package. > > Yes. Still, I'd tentatively suggest adding a feature to span Org- > table cells across rows and columns -- on *export* only. (Sorry if > this has been thought of before.) > > Why? For static tables with complex layout, the table.el integration > is just what the doctor ordered and works really smoothly, and clearly > one would not want to mess up the ease and speed of Org-tables by > adding complexity like row and column spanning in the table editor. > > But what if, say, one is using the spreadsheet functionality, > frequently updates the content for publication, and would like to > e.g. span headers over multiple sub-headers? It seems less than > optimal to maintain and update a separate Org table, then convert it > to table.el and manually edit it every time one wants to publish, > spanning the same cells each time. > > For this purpose, it would be nice to be able to define reusable cell > spans the same way table formulas are entered, and with the same > syntax. Here's an idea for how it might look: Hi Christian, I am willing to offer a hook for this post processing, buy you would have to write the code yourself. - Carsten > > #+CAPTION: Foo and bar sales by region > | Region | Sales | | | | | | | | > | | Q1 | | Q2 | | Q3 | | Q4 | | > | | foo | bar | foo | bar | foo | bar | foo | bar | > |--------+-------+-----+-----+-----+-----+-----+-----+-----| > | North | 350 | 46 | 253 | 34 | 234 | 42 | 382 | 68 | > | South | 462 | 84 | 511 | 78 | 435 | 45 | 534 | 89 | > #+TBLSPAN: A1..A3::A2..I1::B2..C2::D2..E2::F2..G2::H2..I2 > > The exporter would read the TBLSPAN line to see what cells should be > merged. It would concatenate the cell contents (if any), and add the > appropriate HTML, LaTeX or DocBook formatting. [1] > > +--------+-------------------------------------------------+ > | Region | Sales | > | +-------------+-----------+-----------+-----------+ > | | Q1 | Q2 | Q3 | Q4 | > | +-------+-----+-----+-----+-----+-----+-----+-----+ > | | foo | bar | foo | bar | foo | bar | foo | bar | > +--------+-------+-----+-----+-----+-----+-----+-----+-----+ > | North | 350 | 46 | 253 | 34 | 234 | 42 | 382 | 68 | > +--------+-------+-----+-----+-----+-----+-----+-----+-----+ > | South | 462 | 84 | 511 | 78 | 435 | 45 | 534 | 89 | > +--------+-------+-----+-----+-----+-----+-----+-----+-----+ > > Another example: > > | | Col A | Col B | | > |-------+-------+-------+-----| > | Row 1 | A1 | B1 | C1 | > | | A1b | B1b | C1b | > | Row 2 | A2 | B2 | C2 | > | | A2b | B2b | C2b | > #+TBLSPAN: @1$3..@1$4::@2$2..@3$2::@4$3..@5$4 > > would result in output like: > > +---+-----+-----------+ > | | A | B | > +---+-----+-----+-----+ > | 1 | A1 | B1 | C1 | > | | +-----+-----+ > | | A1b | B1b | C1b | > +---+-----+-----+-----+ > | 2 | A2 | B2 C2 | > | +-----+ | > | | A2b | B2b C2b | > +---+-----+-----------+ > > [1] HTML: =rowspan= and =colspan= attributes of the =th= and =td= > elements. LaTeX: =\multicolumn= and =\multirow= commands. DocBook: > =namest=, =nameend= and =morerows= attributes of the =entry= > element. > - Carsten