Categories > OpenTBS with XLSX >

xlsx formula below multiple rows

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Carsten
Date: 2013-11-14
Time: 14:51

xlsx formula below multiple rows

Hi,

I am using OpenTBS for generating Excel files in a web application.
It works pretty well as long as I don't use formulas in my xlsx template
which are in a row below a row which expands to multiple rows when merging data into it.
If the cell containing the formula moves, Excel promts a warning that the file contains invalid data
and attempts to repair the file (deleted formula in /xl/calcChain.xml-Part).

So formulas do work, but only if they don't change their grid position. Any suggestions?


The template code for generating multiple rows looks like this:
[row.content; block=tbs:row; ope=tbs:num]

The TBS version is:
- TinyButStrong - 3.8.1
- OpenTBS - 1.8.1-beta-2013-07-20

Thanks in advance
By: Skrol29
Date: 2013-11-17
Time: 02:00

Re: xlsx formula below multiple rows

Hi Carsten,

There is a warning about this limitation in the XLSX example provided with the package.

It says :

> Do not use a formula in a cell that may have its position changed after the merge (for example under a TBS block).
> Otherwise Excel will raise an error message.
> This is because the location of formulas are saved a second time in another sub-file for the order of evaluation.
> If a formula uses a reference to a cell that has moved during the merge, then the reference will not be arraged to be the new cell reference.

The SXLSX example also show a workaround for a simple Total formula.
By: Carsten
Date: 2013-11-18
Time: 10:13

Re: xlsx formula below multiple rows

Hi Skrol29,

Thank you for your reply!
In the example there are two formula examples.
The simple formula can only be put above the cells whose values are summed up.
The special formula is placed below the generated rows. It changes its own position after merging
and Excel doesn't show a warning. My formula looks similar to that one in the example, but my file generates a warning.
Is there anything I have to do on the PHP side? I already read the demo_merge.php and the demo_ms_excel.php
files but I couldn't find anything.
By: Skrol29
Date: 2013-11-18
Time: 15:42

Re: xlsx formula below multiple rows

> the special formula is placed below the generated rows. It changes its own position after merging

Yes but this formula is using a special formula which doesn't use any reference to a cell address, but rather to cells relatively to the current one.
By: Carsten
Date: 2013-11-21
Time: 12:19

Re: xlsx formula below multiple rows

I noticed the syntax of the special formula, but using the special formula doesn't change anything.
Even if I use a formula which actually doesn't reference cells at all (not absolute nor relative) like
"=SUM(3;1)" (which should always be 4), Excel seems to have a problem if the formula changes its position (no matter if it references other cells or not).
By: Skrol29
Date: 2013-12-13
Time: 02:47

Re: xlsx formula below multiple rows

Can you send to me an example that reproduce your problem ?
By: Gabriel
Date: 2014-03-28
Time: 15:30

Re: xlsx formula below multiple rows

Hi Carsten,

I am having the same problem.
How did you manage it?

I am sure I am close to the solution, but can't figure it out.

Thanks
By: Gabriel
Date: 2014-04-02
Time: 17:00

Re: xlsx formula below multiple rows

I have found out that the warning for corrupted subfile "/xl/calcChain.xml-Part" doesn't appears if a sheet is deleted after the merge is done. It seems a recalculation is done only if a sheet is deleted.

That's why the demo worksheet works OK.
But if you do a small merge without deleting a sheet, then the corruption appears.
By: Skrol29
Date: 2014-04-03
Time: 01:29

Re: xlsx formula below multiple rows

Ok, I can reproduce the bug.
I'm working on a new release and I'll try to include fix for this.
By: Gabriel
Date: 2014-04-03
Time: 14:01

Re: xlsx formula below multiple rows