PRODUCTS

FEATURED PRODUCT

The most powerful, fastest & flexible suite for native Excel file manipulation and Excel,PDF,HTML report generation for .NET

License only 125 EUR See More

SEARCH

LOGIN

Customer login to access products, support information & special benefits.

NEWS ALERTS

Add your e-mail address here to receive the monthly TMS Software alerts.

 

LINKS

EXAMPLE 63

TAdvStringGrid

example 63 : Using subgrouping with TAdvStringGrid

TAdvStringGrid TAdvStringGrid

With the TAdvStringGrid method grid.Group(column) it is possible to let the grid perform an automatic grouping on a column in the grid. In addition to the Group() function, it is possible to let the grid automatically add sub groups with the method grid.SubGroup(column). This subgrouping can be done for multiple columns but it is important that the successive columns for subgroups are right from the last subgroup. To ungroup groups or subgroups, the methods grid.UnGroup() and grid.SubUnGroup() can be used respectively. This code snippet demonstrates how grouping and one subgroup is applied to a grid that loads a CSV file:

procedure TForm1.InitGrid;
begin
  advstringgrid1.Grouping.MergeHeader := true;
  advstringgrid1.Grouping.HeaderColor := clWhite;
  advstringgrid1.Grouping.HeaderColorTo := clInfoBk;
  advstringgrid1.SaveFixedCells := false;
  advstringgrid1.LoadFromCSV('.\cargroups.csv');

  advstringgrid1.Group(1);
  advstringgrid1.SubGroup(1);
  advstringgrid1.ContractAll;
  advstringgrid1.Cells[1,0] :='Brand';
  advstringgrid1.Cells[2,0] :='Type';
  advstringgrid1.Cells[3,0] :='Cyl';
end;


Delphi project & source files for downloading included in the main demos distribution for Delphi.

The project and source files have been written with Delphi 6,7. To use these files in other versions of Delphi, ignore any remarks when opening the form files and save the files. After this, compilation can be done. The error messages are due to properties included in the Delphi 6 form file, but not available in lower versions of Delphi.  

Copyright © 1995 - 2008 TMS Software