Row Groups

Questions and answers on how to use XLSReadWriteII 5.
Post Reply
MicHo
Posts: 4
Joined: Tue Jul 31, 2018 1:53 pm

Row Groups

Post 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
timokhov
Posts: 8
Joined: Sun Oct 28, 2018 4:16 pm

Re: Row Groups

Post 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
d3nton
Posts: 137
Joined: Thu Oct 25, 2012 9:48 am

Re: Row Groups

Post 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.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Row Groups

Post by larsa »

Hello

It looks ok. I will add it to the next update.
Lars Arvidsson, Axolot Data
Post Reply