In Design Studio 7.8.25 and higher, combined with the appropriate eComIntegrate version can use a command called TEXTWRAP (see help for that), for others you need to write one yourself.

(partially taken from old message #539 of the Optio forum)

You can use it as function in the run time Content property of an object like this = BMWordWrap(50, CI("LongLine"))

or you call it in the Custom Formatting field on the mapping like = BMWordWrap(50, {})

One reason that word wrap does not work is that the hight of a segment is independently calculated by multiplying the number of lines in the output field with the Leading. This calculation does not show up in the trace log, because of the way design studio puts it in the code (For 3GL programmers : it looks like some strange form of by reference call). Anyway the content of the output does not resemble the actual text on paper. In my opinion this is an unfinished function.

Remember : this function brakes on char count not on char width (iiiii or WWWWW can be a big difference)

This function is rather context free (you don't have to set global vars) but expects a FLATTEN input string.

FUNCTION "BMWordWrap" ACCEPTS BMWW_Max_char, BMWW_InputString

  LET BMWW_OutputString = ""
  LET BMWW_LineCount = 0

  LET lv_field1 = ""
  LET lv_field2 = ""
  LET lv_cnt = 0
  LET lv_nbr_elements = 0
  LET lv_nbr_blanks = 0

  WHILE PRUNE(BMWW_InputString) <> ""

    LET lv_nbr_elements = lv_nbr_elements + 1
    LET BMWW_InputString = PRUNE(BMWW_InputString)

    LET lv_field1 = ""
    FOR lv_cnt = 1 TO BMWW_Max_char
      LET lv_field2[lv_cnt] = BMWW_InputString[1,((BMWW_Max_char + 1) - lv_cnt)]

    FOR lv_cnt = 1 TO BMWW_Max_char
      LET lv_field1[1,lv_cnt] = lv_field2[lv_cnt]

    LET lv_nbr_blanks = (BMWW_Max_char + 1) - WHERE(" ",lv_field1)
    LET BMWW_OutputString[lv_nbr_elements] = BMWW_InputString[1, 1->lv_nbr_blanks]
    LET BMWW_InputString[1, 1->lv_nbr_blanks] = ""
    LET BMWW_LineCount = BMWW_LineCount + 1

  RETURN BMWW_OutputString

Gesponsorde koppelingen