From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Moe Subject: Re: row and col spaning in table? Date: Wed, 18 Aug 2010 09:32:32 +0200 Message-ID: <4C6B8C90.5010109@christianmoe.com> References: <83bp9sqdec.fsf@yahoo.it> Reply-To: mail@christianmoe.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=35430 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Old84-000504-9V for emacs-orgmode@gnu.org; Wed, 18 Aug 2010 03:32:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Old82-0005wP-V1 for emacs-orgmode@gnu.org; Wed, 18 Aug 2010 03:32:08 -0400 Received: from mars.hitrost.net ([91.185.193.39]:59393) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Old82-0005p0-Lm for emacs-orgmode@gnu.org; Wed, 18 Aug 2010 03:32:06 -0400 In-Reply-To: <83bp9sqdec.fsf@yahoo.it> 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: Giovanni Ridolfi Cc: David Hajage , emacs-orgmode@gnu.org, Carsten Dominik 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: #+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.