Stephane Le Deaut wrote:
> Hello,
> 
> I am using the spreadsheet engine integrated in XXE.
> 
> My problem is the following :
> I am trying to link cells in a table.
> if the cell contains one line it works fine. For example :
> table
>       tgroup
>               tbody
>                       row (1)
>                               entry (A)               entry (B)               
> entry (C)
>                                  1                       2                    
>  = A1 + B1 = 3
> 
> Unfortunately my table contains more than one line per row see below :
>                       row (2)
>                               entry (A)               entry (B)               
> entry (C)
>                                                        para
>                                  1                       2                    
>  = A2 + B2 = ???
>                                                        para
>                                                          3
> 
> I did not find in the documentation how to manage more than one line per
> row.
> How to do it ? Could you give an example ?
> 

In your case, A2+B2 works and gives 24 (as expected).

My problem is that I don't know exactly what you want to do (i.e. A2+B2 
is not a precise spec when B2 contains several paragraphs).

Let's suppose you want to sum every number in A2 and in B2.

---------
Method 1: Give an id to your paras, for example id="p1" and id="p2". The 
formula becomes A2 + $(p1) + $(p2) and gives 6.

---------
Method 2: Use an XPath escape. The formula becomes:

Formula A:
---
cell = B2
= A2 + `sum($cell/*)`
---

and it gives 6 too.

* Note that B2 cannot be directly used by XPath. Only local variables 
such as cell can be referenced in an XPath escape.

* Also note that:

Formula B:
---
cell = B2
paragraphs = `$cell/*`
=(A2 + sum(paragraphs))
---

works too!

But in formula A, "sum" is standard XPath function "sum" and in formula 
B, "sum" is, more powerful, spreadsheet function "sum".



Reply via email to