fastreport formating cpf

To format a CPF (Cadastro de Pessoas FĂ­sicas) in FastReport using Delphi, you can use the following code snippet in the OnBeforePrint event of the TfrxUserDataSet:

function FormatCPF(const cpf: string): string;
begin
  Result := Copy(cpf, 1, 3) + '.' + Copy(cpf, 4, 3) + '.' + Copy(cpf, 7, 3) + '-' + Copy(cpf, 10, 2);
end;

procedure TYourForm.frxUserDataSet1BeforePrint(Sender: TfrxComponent);
begin
  frxMemoView1.Text := FormatCPF(frxUserDataSet1.FieldValue['cpf_field_name']);
end;

Replace "cpf_field_name" with the actual name of the field containing the CPF in your dataset. This code will format the CPF into the standard Brazilian format with the periods and hyphen.