How to set WPAT_NoWrap on a TWPTextObj object

  • Currently it is possible to have no text wrapping of a table cell by setting ASet(WPAT_NoWrap, 1) on the TParagraph of the cell. For this to work properly, you need to have [wpAllow_WPAT_NoWrap] in the FormatOptionsEx.

    What I need to have is to be able to set a similar WPAT_NoWrap property on a TWPTextObj object instead of the TParagraph.

    Here is a visual sample of what I need to have:

    Code
    +--------------------+
    |This text must be   |
    |displayed on        |
    |multiple lines: []  |
    +--------------------+

    The [ ] placeholder is an input edit field create with InputEditField. I want the text "This text must be displayed on multiple lines:" to be displayed on multiple lines, but I want the text entered in between the [ ] markers to be displayed on a sigle line with no wrapping.

    Is this possible ?

    The only workaround I found is putting the InputEditField on a seperate line in the cell or to create another cell to the right containing only the InputEditField.


    Michel W.

  • Michel,

    Until Julian responds with what is sure to be a more correct and / or elegant response, see if this helps.

    Since you say you already have the TWPTextObject, you can take advantage of its Wrap property:

    Code
    procedure SetTextObjectProperties( ImageTextObj : TWPTextObj );begin   with ImageTextObj do begin          PositionMode :=  wpotPage;          relx := 0;  // you might want to change this          rely := 0;  //and this one as well          Wrap := wpwrNone;       // what the heck, I felt like throwing the next line in          Mode := Mode + [ wpobjObjectUnderText ];   end;end;


    Alternatively, you can set the Wrap property once for ALL TWPTextObjects:

    Code
    WPRichText1.TextObjects.DefaultWrapMode     := wpwrNone;


    Hopefully that points you in the right direction.

    Regards,
    diamond

    • Offizieller Beitrag

    Many thanks to JazzMan - the anwer is correct but was connected to the premium versions and the text boxes which are included there.

    Zitat

    What I need to have is to be able to set a similar WPAT_NoWrap property on a TWPTextObj object instead of the TParagraph.

    A TWPTextObj is just a character, it cannot have multiple lines unless they are custom painted (there is an event).

    You are talking about a merge field - such a field consists of two TWPTextObj instances and some text inbetween. This text does not behave differently to nurmal text.

    To solve your problem I suggest to use a table and place a merge field inside.

    Julian