formatting strings into rich text box - InfoPath Dev
in

InfoPath Dev

formatting strings into rich text box

Last post 12-12-2005 12:31 PM by winnipeg. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 10-20-2005 08:23 PM

    formatting strings into rich text box

    Hi,
    I have the following function which is meant to get the values from the textboxes and then apply some formatting so that each value will appear one per line.

    function str()
    {
    var Function_Name = XDocument.DOM.selectSingleNode("/my:myFields/my:Function_Name").text;
    var myRichTextBox_node = XDocument.DOM.selectSingleNode("/my:myFields/my:Purpose");

    var output = null;
    output = "'********************" + "\r";
    output += "\r" + "'" + "\t" + "FunctionName : " + Function_Name;

    myRichTextBox_node.text = output;
    }

    correct output should be:
    '*********************
    ' FunctionName : valueOFvaarFunctionName

    but, the rich text box is ignoring the \r - carriage return
    instead i output is a follows:
    '*********************' FunctionName : valueOFvaarFunctionName

    Any suggestions greatly appreciated
  • 10-21-2005 06:36 AM In reply to

    Re: formatting strings into rich text box

    Instead of using "\r" use "\n". "\r" is the code for a hard carriage return, and in this situation would probably be the equivalent of submitting your form if you had a submit form button on your page. "\n" is just the newline character, and is used much more frequently. I've actually never used \r.

    Anyway, if this still doesn't work, I think rich textboxes use HTML to do their formatting so you could try using "<br>" instead.

    ---------------
    Matt Faus
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
  • 10-21-2005 07:02 AM In reply to

    Re: formatting strings into rich text box

    Hi,

    You can use \r and \n in a textbox, as long as you go to Properties / Display Tab and check the "Paragraph breaks" checkbox.
    So, you can achieve the display that you are looking for using a textbox, not a Rich Textbox.
    If you still want you use a Rich Text Box, which stores XHTML, you need to use appendChild to add lines...(I would stick to option 1).

    Hope that it helps.

    Regards,

    Franck Dauché
  • 10-24-2005 04:01 PM In reply to

    Re: formatting strings into rich text box

    thanks for your help
  • 12-12-2005 12:31 PM In reply to

    Re: formatting strings into rich text box

    Hi Franck,

    Do you happen to have any sample code on how to do this at all? What I'm looking for is the appendChild you mention. I have a rich text box and when user check a checkbox it appends text to the rich text box. I can get it to work find with normal text with the replace statement but can't seem to get it to work with rich text. The reason I'm going with rich text instead of normal text box is because I need to transform the result into a word document.

    Thanks for any help.

    Howard.
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.