WordWrap at non letter or number?

Posted by: neal007 on 4 August 2017, 3:19 pm EST

  • Posted 4 August 2017, 3:19 pm EST

    Hello,



    I have a field in a simple report which holds a list of airport identifiers I call "Route of Flight". For example:



    RIC-DEN-LAX-DFW-JFK-RIC



    The problem is that when wordwrap occurs it wraps on any character and I need it to wrap at a hyphen.



    So I get:



    RIC-DEN-L

    AX



    But I want:



    RIC-DEN-

    LAX



    Is there a way to implement this?



    Thank you.
  • Replied 4 August 2017, 3:19 pm EST

    You can measure the field's value in the section's Format event and add custom logic for word wrapping:



    Private Sub Detail_Format()

    Dim val As String, w, h As Variant

    val = Field1.Text

    Canvas.MeasureText val, w, h



    If w > Field1.Width Then

    ' Custom word-wrap logic modifying value of the val variable

    End If



    Field1.Text = val

    End Sub

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels