Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TAdvStringGrid
Printing only selected rows in disjunct row select mode

The disjunct row select mode is flexible to let the user select several non contiguous rows in a grid. When you want to print only the selected rows, the Print functions do not provide a possibility these rows. Thanks to the grid's row hiding capabilities this can be easily done by temporarily hide the non-selected rows, print the grid and then unhide these rows again. The code to hide only the not selected rows is :
var
  i,j: Integer;
begin
  i := 1;
  with AdvStringGrid do
  begin
    j := RowCount;
    while (i < j) do
    if not RowSelect[DisplRowIndex(i)] then
      HideRow(i);
    Inc(i);
  end;
end;
To unhide the rows again after the print, the method UnHideRowsAll can be called.