Tried to make alternate row background colors based on one of the demos.
Myformat(background)
It's a cross report, so it's not guaranteed all "grid" cells will be filled.
<#format cell(xxxx)> ... does not work on these cells when there's no value..
Is there any way to force #format row/cell to apply the desired format even when there's no content to display?
In this case, it's a backgorund format - in some cases (like this), it would be better if it could be forced.
Hi,
I am not 100% sure on how the report is working, if you can post a template it could help.
But anyway, some ideas to check:
Format row indeed formats the empty cells in the row, because cells with content have their own cell format and that takes priority over the row format (this is the way Excel works): FlexCel Reports Tag Reference. | FlexCel Studio for VCL and FireMonkey documentation
So maybe specifying both format row and format cell could fix it? Format cell will format the cells that the report fills in, and the others will be formatted with the row format.
You might want to use a table if possible (insert->table in Excel). This has an option to automatically do alternate row colors (the FlexCel demos are actually from before tables existed, today I would start by trying tables, and only if they don't work for the particular case try a different solution)
Finally you can also try conditional formatting. Conditional formatting applies almost everywhere format cell works, and it is normally easier to setup. Again, the full format cell thing predates the conditional formats that appeared in Excel 2007 (older ones were very limited), but today, normally it is more maintainable to use conditional formats instead. Of course, it depends on the case, and there are cases where format cell is still the best solution, but those are way less than before.
In the example image, when I use <#format row , no cells in the pivot zone got the alternate background, not even those with content.
That's expected, the row format applies to empty cells. Cells with content have their own format specified in the cell, and that overrides the row format. So the idea is to write both <#format row> and <#format cell> in the same cell in the template, so it applies to both empty and non empty cells. But well, in any case, if you can send me the template I can get a better understanding on what is happening and probably suggest something else.
Please note that when I used row format, no cells of the pivot area got formatted. Neither empty, neither with content.
Now using both, those affected by <#format cell also get the color, but the empty ones remain with no background. It's the same result as using just <#format cell .
Now I see it more clearly ...
When the crostab doesn't have data, the cell isn't processed at all. I tried many things, #if's, ";" alternative value, indirect use of expression, and nothing could generate any content or conditional formatting for those cells.
And now I could confirm this even more: I just put a literal letter A before the field tag, and it didn't generate anything either.