Report with repeated columns and spanned cells in heading

We have an ods report template that looks like this:

When generating the report, the following error occurs:

Exception: Incoherent column repetition found! If a table has several lines with repeated columns, the repetition need to be on the same columns across all lines.

This error is not related to spanned cell D1, but it depends on spanned cells A1, A2 and B1, B2.

The error disappears if you remove column B:

The error is also absent if cells B1 and B2 are splitted:

The error is also absent if cells A1 and A2 are splitted:

But the error comes back if all cells A1, A2, B1, B2 are splitted.

It seems to be a relatorio bug, isn’t it?

Did you try to use one raw sheet to collect data and an other one for calculation and presentation ?
If it is possible, it would be easier to design and maintain, wouldn’t it ?

Repeat columns inside rows that have been merged vertically is most of the time not supported. Indeed it depends highly on how at the end the editor decided to store in XML the layout (which may depend on how the cells where edited and in which order).
So I would not qualify this as a relatorio bug but as a feature not supported yet by relatorio. If someone make a proposal to improve the algorithm to support more cases, it will be welcomed.

This is a good idea, but difficult to implement in the case of a report with a variable number of columns.

We found a workaround for the problem by splitting cells B1, B2 and setting them different formats (for example: B1 - Text, B2 - Number). Then we merged these cells again.
Here is a document generated from the modified template:

Of course, this leaves the problem with invalid column widths that was discussed here:
Strange column widths in report with repeated columns

We have prepared a patch that fixes this bug:

Here is a document generated from the first template after fixing:

This patch also fixes the following bug:
Strange column widths in report with repeated columns