Well, it seems a good solution to me!
David


On Wed, Aug 18, 2010 at 09:32, Christian Moe <mail@christianmoe.com> wrote:
Giovanni Ridolfi wrote:
David Hajage <dhajage@gmail.com> 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.