Page 1 of 1

Row Groups

Posted: Sun Nov 18, 2018 11:52 am
by MicHo
Hi Larsa,

I try to create a row group with initialized row status = "collapsed".
For example:
"Xls[0].GroupRows(firstGroupRow, lastGroupRow, true);"

But ACollapsed Parameter in TXLSWorksheet.Grouprows don’t works, rows are allways expanded

What's wrong? Could you help please?

Thanks in advance
Michael

Re: Row Groups

Posted: Sun Nov 18, 2018 1:54 pm
by timokhov
Hi Michael,

I do the same task like this:

Code: Select all

Xls[0].GroupRows(firstGroupRow, lastGroupRow, [b]False[/b]);
Xls[0].Rows.ToggleGrouped(lastGroupRow+1);
It works fine

Re: Row Groups

Posted: Wed Jun 26, 2019 6:53 am
by d3nton
Hi!

I run into the same problem.
As far as I can see in the source code in procedure TXLSWorksheet.GroupRows there is just one line missing
in order to make
"Xls[0].GroupRows(firstGroupRow, lastGroupRow, true);
work properly:"

procedure TXLSWorksheet.GroupRows(const ARow1, ARow2: integer; ACollapsed: boolean);
var
i,Level: integer;
Row: TXLSRow;
begin
for i := ARow1 to ARow2 do begin
Row := FRows;
Level := Row.OutlineLevel;
Inc(Level);
if Level > 7 then
raise XLSRWException.Create('Row grouping level more than 7.');
Row.OutlineLevel := Level;
Row.CollapsedOutline := ACollapsed;
// MISSING
Row.Hidden := ACollapsed;
end;
end;

A similar fix can be done in
TXLSWorksheet.GroupColumns:
just add
Col.Hidden := ACollapsed;
at the end

@Larsa:
If this is correct, could you please add fix this in the next version? Thank you.

Re: Row Groups

Posted: Thu Jun 27, 2019 9:34 am
by larsa
Hello

It looks ok. I will add it to the next update.