Fórum Justificar texto no QuickReport, como? #365980
10/11/2008
0
Bom dia pessoal, gostaria de saber se alguém sabe ou já fez isso.
Como justificar um texto no QRMemo ou QRRichText no Delphi 2006?
Obrigado a todos,
Como justificar um texto no QRMemo ou QRRichText no Delphi 2006?
Obrigado a todos,
Jc
Curtir tópico
+ 0
Responder
Posts
10/11/2008
Laclaudi
JC,
Bom a forma que encontrei para fazer isso foi inserir um componente RichEdit da guia Win32, fazer a formatação nele atraves da função:
// AllText: True = todo o texto; False = parágrafo atual
procedure JustifyRichText(RichEdit :TRichEdit; AllText :Boolean);
const
TO_ADVANCEDTYPOGRAPHY = $1;
EM_SETTYPOGRAPHYOPTIONS = (WM_USER + 202);
EM_GETTYPOGRAPHYOPTIONS = (WM_USER + 203);
var
ParaFormat :TParaFormat;
SelStart,
SelLength :Integer;
begin
ParaFormat.cbSize := SizeOf(ParaFormat);
if SendMessage(RichEdit.handle,
EM_SETTYPOGRAPHYOPTIONS,
TO_ADVANCEDTYPOGRAPHY,
TO_ADVANCEDTYPOGRAPHY) = 1 then
begin
SelStart := RichEdit.SelStart;
SelLength := RichEdit.SelLength;
if AllText then
RichEdit.SelectAll;
ParaFormat.dwMask := PFM_ALIGNMENT;
ParaFormat.wAlignment := PFA_JUSTIFY;
SendMessage(RichEdit.handle, EM_SETPARAFORMAT, 0, LongInt(@ParaFormat));
// Restaura seleção caso tenhamos mudado para All
RichEdit.SelStart := SelStart;
RichEdit.SelLength := SelLength;
end;
end;
E para imprimir justificado coloco um QRRichText... e seto a opção ParentRichEdit para o RichEdit que coloquei e formatei.
No Botão de impressão... passo o Parametro do banco de dados para o RichEdit, faço a Justificação... e Mando Imprimir;
RichEdit1.Text:= IBQryTestes.FieldByName(´CAMPO´).AsString;
JustifyRichText(RichEdit1, False);
Bom a forma que encontrei para fazer isso foi inserir um componente RichEdit da guia Win32, fazer a formatação nele atraves da função:
// AllText: True = todo o texto; False = parágrafo atual
procedure JustifyRichText(RichEdit :TRichEdit; AllText :Boolean);
const
TO_ADVANCEDTYPOGRAPHY = $1;
EM_SETTYPOGRAPHYOPTIONS = (WM_USER + 202);
EM_GETTYPOGRAPHYOPTIONS = (WM_USER + 203);
var
ParaFormat :TParaFormat;
SelStart,
SelLength :Integer;
begin
ParaFormat.cbSize := SizeOf(ParaFormat);
if SendMessage(RichEdit.handle,
EM_SETTYPOGRAPHYOPTIONS,
TO_ADVANCEDTYPOGRAPHY,
TO_ADVANCEDTYPOGRAPHY) = 1 then
begin
SelStart := RichEdit.SelStart;
SelLength := RichEdit.SelLength;
if AllText then
RichEdit.SelectAll;
ParaFormat.dwMask := PFM_ALIGNMENT;
ParaFormat.wAlignment := PFA_JUSTIFY;
SendMessage(RichEdit.handle, EM_SETPARAFORMAT, 0, LongInt(@ParaFormat));
// Restaura seleção caso tenhamos mudado para All
RichEdit.SelStart := SelStart;
RichEdit.SelLength := SelLength;
end;
end;
E para imprimir justificado coloco um QRRichText... e seto a opção ParentRichEdit para o RichEdit que coloquei e formatei.
No Botão de impressão... passo o Parametro do banco de dados para o RichEdit, faço a Justificação... e Mando Imprimir;
RichEdit1.Text:= IBQryTestes.FieldByName(´CAMPO´).AsString;
JustifyRichText(RichEdit1, False);
Responder
Gostei + 0
12/11/2008
Leonardo_age
Amigo,
Infelizmente não tenho mais esse componente, mas existe um componente com o nome mais ou menos QRMemoJustify que possui esse recurso, e o melhor é que é gratuito.
Pena não te-lo ainda, senão lhe encaminhava por e-mail mas não é dificil de achar não!
Abraços.
Infelizmente não tenho mais esse componente, mas existe um componente com o nome mais ou menos QRMemoJustify que possui esse recurso, e o melhor é que é gratuito.
Pena não te-lo ainda, senão lhe encaminhava por e-mail mas não é dificil de achar não!
Abraços.
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)