Alinhamento Justificado com o RQDBRICHTEXT

Delphi

18/12/2003

Preciso justificar o RQDBRICHTEXT alguém sabe, ou outro componente??



Obrigado,


Meu Email: gleidison@unsoft.com.br


Gleidisonsandro

Gleidisonsandro

Curtidas 0

Respostas

Fabio.hc

Fabio.hc

18/12/2003

Tenho esta função que justifica texto, talvez te ajude.


function Justifica(mCad:string;mMAx:integer):string;
var
   mPos,mPont,mTam,mNr,mCont:integer;
   mStr:string;
begin
   mTam:=Length(mCad);
   if mTam>=mMax then
      Result:=copy(mCad,1,mMax)
   else
      mStr:=´´;
   mCont:=0;
   mPont:=1;
   mNr:=mMax-mTam;
   while mCont<mNr do
      begin
      mPos:=pos(mStr,copy(mCad,mPont,100));
      if mPos=0 then
         begin
         mStr:=mStr+´ ´;
         mPont:=1;
         continue;
         end
      else
         begin
         mCont:=mCont+1;
         Insert(´ ´,mCad,mPos+mPont);
         mPont:=mPont+mPos+length(mStr);
         end;
      Result:=mCad;
      end;
end;


Exemplo:

procedure TForm1.Button1Click(Sender: TObject);
var i:integer;
begin
   for i:=1 to Memo1.Lines.Count do
      if Memo1.Lines[i] <> ´´ then
         Memo1.Lines[i]:=Justifica(Memo1.Lines[i],60);
end;



GOSTEI 0
POSTAR