Rich text box changes format - InfoPath Dev
in

InfoPath Dev

Rich text box changes format

Last post 11-06-2008 02:56 AM by Shiva. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 11-03-2008 08:23 AM

    Rich text box changes format

    Hi

    We have a solution where we have a Sharepoint document library with infopath forms. The forms contains some data and a rich text box. The users takes existing word documents, saves them as html and then paste them into the rich text box.

    We also have a infopath client application that uses some of the data from the forms in the sharepoint library. For doing this we use a web service that collects the data from the forms in the library. The web service works as data source for the client application.

    The issue we have is that all the data transfers smoothly through the web service except the text in the rich text box. For some reasons it loses/changes some of the formatting on the way. It could for example add italic to some text.

    We just takes the innerxml of the node containing the rich text box and copies it to the node in the client app that holds the rich text box.

    Do you know of any related problem when copying text beteen rich text boxes using code?

    Best regards,
    Niclas

  • 11-06-2008 02:56 AM In reply to

    • Shiva
    • Top 25 Contributor
    • Joined on 04-15-2005
    • India
    • Posts 694

    Re: Rich text box changes format

    Hello,

    Here is the code to set the Rich text box node value,

    private void SetRichTextNodeValue(IXMLDOMNode node, IXMLDOMNode valueNode)

    {

    if(valueNode.firstChild == null)

              {

                        string value = valueNode.ToString();

                        if(node.text != value)

                                 node.text = value;

              }

              else

              {

                        node.text = String.Empty;

                        IXMLDOMNodeList childNodes = valueNode.childNodes;

                        foreach(IXMLDOMNode childNode in childNodes)

                        {

                                  node.appendChild(childNode.cloneNode(true));

                       }

              }

    }

    Here node is Rich text box node and valueNode is to get the data from this node.

    Note: This code is in C#.

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