Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Justify RTF (Very Important)

edited October 2006 in General
I see the help to justify an *.RTF and it is not possible.

Any Idea to Justify a RTF. ( NOT Center, Not Right, Not Left ) like word.
it's very important. I must to print a contract about six pages and my
client don't like to alignement Left, right.

Thanks...


--
Un saludo


Jaime Lloret.
Jefe de Desarrollo de Proyectos Software.
ISCOPYME, S.L.

CL?USULA DE CONFIDENCIALIDAD: ISCOPYME, S.L garantiza la confidencialidad de
los datos que obran en su poder y seg?n lo estipulado por la LOPD (Ley
Org?nica 15/1999 de 13 de diciembre de Protecci?n de Datos de Car?cter
Personal). Este mensaje se dirige exclusivamente al destinatario consignado.
Puede contener informaci?n confidencial, de nuestra propiedad o legalmente
protegida. Si usted no es el destinatario, le informamos que cualquier
acceso, divulgaci?n, copia o distribuci?n de la informaci?n, as? como
cualquier acci?n u omisi?n realizada con base a la misma, queda prohibida y
puede ser ilegal. En caso de haber recibido este mensaje por error, le
rogamos que nos lo reenv?e y notifique inmediatamente, borrando toda copia
de su sistema. Gracias.


ISCOPYME, S.L.
Ingenier?a del Software y Consulting para la PYME.
Servicios Inform?ticos.

Tel : 966 688 12 88
Fax : 966 688 20 29
C/ Pintores, N? 19.
03590 - ALTEA - Alicante
Espa?a.

www.iscopyme.com
Administraci?n : admin@iscopyme.com
Depto. Software : soft@iscopyme.com
SAT : sat@iscopyme.com

Comments

  • edited October 2006

    Below are some options for adding more advanced RichText support to RB. I
    think one or more of the options below supports full text justification.

    ----------------------------------------------
    Article: ReportBuilder's RichText architecture
    ----------------------------------------------


    The RichText in ReportBuilder is a wrapper around Delphi's TRichEdit which
    in turn relies on Windows. There are two versions of Windows richedit -
    RichEd32.dll is the older one and RichEd20.dll is a newer one (RichEd32 is
    being phased out). Delphi by default relies on RichEd32 - the older version.
    To use some of the more advanced features of Windows RichEdit, see the topic
    on InfoPower RichEdit Support below.

    In general Windows RichEdit supports the type of formatting that you can do
    using WordPad.



    InfoPower RichEdit Support
    ---------------------------
    InfoPower from Woll2Woll Software is a popular database add-on product for
    Delphi. InfoPower's TwwRichEdit components support the Windows RichEdit2
    format. This format allows the rich text data to contain embedded bitmaps
    and OLE objects. For more information please see http:\\www.Woll2Woll.com.

    ReportBuilder includes a component that enables the TppRichText and
    TppDBRichText controls in ReportBuilder to use the formatting capabilities
    of InfoPower's TwwRichEdit when rendering RTF data. The ppWWRichEd.pas unit
    located in the ..\RBuilder\InfoPower directory defines a TwwDBRichEdit
    descendant and then registers the class with ReportBuilder. This enables the
    TppRichText and TppDBRichText controls in ReportBuilder to use the
    formatting capabilities of TwwDBRichEidt when rendering data.


    WPTools Support
    ----------------
    WPTools is a collection of components used to edit and print formatted text.
    With its own RTF engine, WPTools offers numerous features not supported by
    the standard Windows RichEd20.dll. This control lets you use tables,
    paragraph frames, headers and footers etc. Using the optional ReportBuilder
    support units for WPTools 2.x, you can print the enhanced WPTools features
    (justified text, tables, graphics...) within your ReportBuilder reports. For
    more information please see http:\\www.wptools.de.

    TRichView
    ----------
    TRichView is a suite of native Delphi components for displaying, editing,
    and printing hypertext documents. Documents can contain tables, pictures,
    and images. TRichView is available from www.trichview.com. There is a
    wrapper for available for using TRichView inside ReportBuilder, see
    http://www.digital-metaphors.com/Subpages/Downloads/CompanionRCL.html or
    http://www.trichview.com/resources/




    --
    Tech Support mailto:support@digital-metaphors.com
    Digital Metaphors http://www.digital-metaphors.com


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com




    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2006
    I create a Method Justify in TCustomRichEdit and it works fine with
    TRichEdit. How can I do it in ReportBuilder ?

    Thanks.




  • edited October 2006

    - Best solution is to descend from the TppRichEdit class (which itself is a
    simple descendent of TRichEdit) and register your custom version for use
    with RB. An example registration appears at the bottom of the unit containg
    the TppRichEdit class. The TppRichEdit is defined in ppRichTxDrwCmd.pas (or
    if you are using an older version of RB it is located in ppDrwCmd.pas).

    - Would you be willing to share this solution with us so that we could add
    it to a future release of RB? If so, please email
    support@digital-metaphors.com.


    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2006
    the code is like this

    procedure TRichEdit.Justificar;
    const
    WM_USER = $400;
    EM_EXSETSEL = (WM_USER + 55);
    EM_SETTYPOGRAPHYOPTIONS = (WM_USER + 202);
    EM_GETTYPOGRAPHYOPTIONS = (WM_USER + 203);
    TO_ADVANCEDTYPOGRAPHY = $1;
    mZERO = $0;
    var x :tparaformat;
    L :LongInt;
    cp :charrange;
    begin
    x.cbSize := sizeof(x);
    if SelLength = 0 then
    begin
    cp.cpMin := 0;
    cp.cpMax := length(Text);
    SendMessage(Handle,EM_EXSETSEL,mZERO,LPARAM(@cp));
    end;
    L := SendMessageA(Handle,EM_SETTYPOGRAPHYOPTIONS, TO_ADVANCEDTYPOGRAPHY,
    TO_ADVANCEDTYPOGRAPHY);
    if L = 1 then
    begin
    SendMessageA(Handle, EM_GETTYPOGRAPHYOPTIONS, mZERO, mZERO);
    SendMessage(Handle, EM_GETPARAFORMAT, mZERO, LPARAM(@x));
    x.dwMask := PFM_ALIGNMENT;
    x.wAlignment := PFA_JUSTIFY;
    SendMessage(Handle, EM_SETPARAFORMAT, mZERO, lparam(@x));
    end;
    cp.cpMin := 0;
    cp.cpMax := 0;
    SendMessage(Handle,EM_EXSETSEL,mZERO,lparam(@cp));
    WordWrap := true;
    end;

    but i don't know in what class Tp**** i have to put this code ?


  • edited November 2006
    > but i don't know in what class Tp**** i have to put this code ?

    - The TppRichText and TppDBRichText are the components that you use in your
    RB Reports. These are wrapper classes that internally rely upon a
    TCustomRichEdit descendant.(see ppRichTx.pas.)

    TppCustomRichText
    TppRichText
    TppDBRichText


    - By default the RB RichText classes listed above, rely upon the TppRichEdit
    class (which itself is a
    simple descendent of TRichEdit) The TppRichEdit is defined in
    ppRichTxDrwCmd.pas (or
    if you are using an older version of RB it is located in ppDrwCmd.pas). It
    is possible to replace the TppRichEdit with a custom descendant.

    TRichEdit
    TppRichEdit


    I think the challenge you may be encountering is that you can add your
    custom method to a descendant of TppRichEdit and register it for use with
    RB, but then how do you use it?

    You might need to descend from TppRichText and TppDBRichText so that you can
    add a new property.



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.