Options

Text wrapping

mcomco Member Posts: 5
Hi all,
I wrap text on the report in textbox. The length of textbox is limited. Can I dinamicaly change highness of this textbox (in dependence on number of rows in wrapped text)? The solution with max.high textbox isn't usable -it creates blank useless rows.
Martin

Comments

  • Options
    Timo_LässerTimo_Lässer Member Posts: 481
    I think the only way is to define several sections with several textbox hight
    e. g. 1st section Textbox shows 1 line, 2nd shows 2 lines, ...
    With CurrReport.SHOWOUTPUT you define - according to the length of the text - which section will be shown.
    Timo Lässer
    Microsoft Dynamics NAV Developer since 1997
    MSDynamics.de - German Microsoft Dynamics Community - member of [clip]
  • Options
    mcomco Member Posts: 5
    Problem is,how can I determine, which from this defided sections/textbox use/display. I can't use metric font (doesn't support desired small font)and non metric fonts have different width - can't count letters.
  • Options
    kinekine Member Posts: 12,562
    There are two ways:

    1) Approximate the length of text counting chars (for each char have predefined width to add) - for example width of i=x, width o=y...

    2) Create OCX wrapper for windows function GetTextExtentPoint or some other and use this for calcualting width of the string...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    mcomco Member Posts: 5
    Good idea to create OCX with function GetTextExtentPoint :) But there is a problem with handle to Device Context of report window. How can I obtain it?
    Many thanx,
    Martin
  • Options
    mcomco Member Posts: 5
    Ops, OCX seems to be finished :)
    Thanx guys
  • Options
    DenSterDenSter Member Posts: 8,304
    or....

    you cut the string up into bite size chunks (say 80 characters) and put them into a text array. While you are filling this array, you keep score of how many elements you have in an integer variable called something like NumberOfElements.

    Next, you insert an Integer dataitem, with a body section that has a text box with your TextArray[Number] as its source expression. OnPreDataItem you do Integer.SETRANGE(0,NumberOfElements), and the dataitem will display your pieces of text without any blank lines.
  • Options
    PrebenRasmussenPrebenRasmussen Member Posts: 137
    Maybe you can use my NDI from the download section. This will give you the possibility of measuring the with and height of a particular string based on the selection of a fontface and fontsize.

    Give it a try!
Sign In or Register to comment.