Bigtext in a report

dulamandulaman Member Posts: 73
Hi,

I'd like to know if there is some way to insert *a lot* of text in a report, some two pages from MS Word. I mean, this special report has to be a standard contract and I have managed to insert all the clauses using labels, but it should exist a better solution, I guess--?
-- dulaman
"I don't want to believe. I want to know." (Carl Sagan)

Comments

  • krikikriki Member, Moderator Posts: 9,110
    Well, you can make a textbox multiple line (see the property) but it is limited to 1024 characters. The variable type "BigText" cannot be used in visual components (SourceExpression, in message, confirm, error,...) :(
    So probably there is not a better solution. Exept putting all in a table and printing the table.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • dulamandulaman Member Posts: 73
    Thanks kriki. I was afraid to know that -- but i didn't want to admit.

    I think the 1024 chars limit is not enough even for the first clause!
    This contract is longer than the Marx Brothers one ! :)
    -- dulaman
    "I don't want to believe. I want to know." (Carl Sagan)
  • kinekine Member Posts: 12,562
    And you will have problem with word wrapping... Better is to connect the word doc. to Navision data and print it from word. You can use same functionality like in CRM module when creating letter...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • dulamandulaman Member Posts: 73
    Yep, kine. That's my actual problem: wrapping. Helvetica fonts (and Arial, too) don't seem to understand that they should follow my wishes! :)

    I'll have to find out how could I connect my doc to Navision. Gonna snoop around the forum as I've never done such a thing.
    -- dulaman
    "I don't want to believe. I want to know." (Carl Sagan)
  • kinekine Member Posts: 12,562
    There exist some example, how to connect Word to Navision through C/AL code... check the download section or How to section...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • gfrgfr Member Posts: 10
    Hi,

    If you want to use a bigtext variable and to cut it in pieces to show it as lines on a report you can do this for instance:

    Define a function FindSplitPosition like this:

    FindSplitPosition(TextToSplit : Text[200]) CharPosition : Integer

    CharPosition := 0;
    MyCounter := STRLEN(TextToSplit);
    REPEAT
    IF COPYSTR(TextToSplit,MyCounter,1) IN THEN
    CharPosition := MyCounter;
    MyCounter := MyCounter - 1;
    UNTIL (MyCounter = 0) OR (CharPosition > 0);
    IF CharPosition = 0 THEN
    CharPosition := STRLEN(TextToSplit);

    This function will look in TextToSplit if there is a space, point or a comma beginning from the end of the sentence. You can use the function on your report like this :

    If you have a variable to split called MyBigTxt, you want to split it in sentences and print it in the section of the report with TextToPrint for instance.

    If you have a DataItem which is an integer for instance, put this code in the OnPreDataItem trigger:

    Pos := 1;

    Put next code in the OnAfterGetRecord trigger of the dataitem:

    IF MyBigTxt.LENGTH <= 0 THEN
    CurrReport.BREAK;

    TextToPrint := '';
    IF (MyBigTxt.LENGTH > Pos) THEN BEGIN
    IF (MyBigTxt.LENGTH - Pos >= MAXSTRLEN(TextToPrint)) THEN
    BEGIN
    MyBigTxt.GETSUBTEXT(TextToPrint,Pos,MAXSTRLEN(TextToPrint));
    Pos2 := FindSplitPosition(TextToPrint);
    TextToPrint := COPYSTR(TextToPrint,1,Pos2);
    Pos := Pos + Pos2;
    END
    ELSE
    BEGIN
    MyBigTxt.GETSUBTEXT(TextToPrint,Pos,MyBigTxt.LENGTH);
    CLEAR(MyBigText);
    END;
    END ELSE
    CurrReport.BREAK;

    Put the control with TextToPrint on your section and you will be able to cut a BigText variable in sentences without cutting the words in the middle. I hope this help you.

    Regards,
    Giovanni
Sign In or Register to comment.