How To…Skip First X Labels

Question

“How can I skip the first X number of labels on a sheet, so that my users can reuse label sheets?”

Solution

The following exmple shows how to use the DetailBand.BandsPerRecord to to skip X number of labels.

Download: SkipLabels.zip
Download: SkipLabelsLeftToRight.zip

Sample Delphi code:

procedure TForm1.btnPreviewClick(Sender: TObject);
begin

  // get number of labels to skip plus one
  FSkipCount := StrToInt(Edit1.Text) + 1;

  ppReport1.Print;

end;

procedure TForm1.ppReport1StartPage(Sender: TObject);
begin

  // configure report to generate SkipCount number of empty labels
  if ppReport1.AbsolutePageno = 1 then
    begin
      ppReport1.DetailBand.BandsPerRecord := FSkipCount;
      FBandsPerColumn := 0;
      ppDBCalc1.Visible := False;
      ppDBText1.Visible := False;
    end;

end;

procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
var
  liBandsGenerated: Integer;
begin

  // calc number of bands generated 
  liBandsGenerated := ((ppReport1.CurrentColumn - 1) * FBandsPerColumn) + ppReport1.DetailBand.Count;

  // determine whether to start generating labels
  if (liBandsGenerated = (FSkipCount - 1)) then
    begin
      ppReport1.DetailBand.BandsPerRecord := 1;

      ppDBCalc1.Visible := True;
      ppDBText1.Visible := True;
    end;
end;

procedure TForm1.ppReport1EndColumn(Sender: TObject);
begin

  // calc bands per column
  if (FBandsPerColumn = 0) then
    FBandsPerColumn := ppReport1.DetailBand.Count;

end;