InfoPath 2003 Rich Text Box line seperation - InfoPath Dev
in

InfoPath Dev

InfoPath 2003 Rich Text Box line seperation

Last post 06-04-2010 03:11 AM by Niroshan. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-02-2010 12:16 AM

    InfoPath 2003 Rich Text Box line seperation

     Hi All,

     I am currently working in a project which use Infopath 2003 and VS 2005. in our infopath application we have many views which have Rich Text boxes.

    When we save the Infopath form, it saves as an XML file. Rich text box values are save with DIV tags for each lines and those dive tags come under the tag relevant to the RichTextBox node.

    When we try to retrieve data from the XML and populate to Infopath form we do not get text in seperate lines ( get text as a single line)

    I tried with following ways.

    Try One  -   domNode.text = xmlNode.InnerText;

    Try Two  -   xmlNode.InnerXml.Replace("</div>", "\r\n</div>");
                    domNode.text = xmlNode.InnerText;

    Try Three  -   XmlDocument xmlDocument = new XmlDocument();
                     xmlDocument.LoadXml(xmlNode.InnerXml);
                     domNode = (IXMLDOMNode)xmlDocument;

    Try Four  -   foreach (XmlNode node in xmlNode.ChildNodes)
                      {
                            IXMLDOMNode childNode = domNode.ownerDocument.createElement("div");
                            IXMLDOMAttribute attribute = domNode.ownerDocument.createAttribute("xmlns");
                            attribute.value = "http://www.w3.org/1999/xhtml";
                            childNode.attributes.setNamedItem(attribute);
                            childNode.text = node.InnerText;
                            domNode.appendChild(childNode);
                      }

     Try Five  -  string richTextData = xmlNode.InnerXml.Replace("<div xmlns=\"http://www.w3.org/1999/xhtml>", string.Empty);
                     domNode.text = richTextData.Replace("</div>", "\r\n");

     

    Pleas help me on this..

     

    Filed under: ,
  • 06-04-2010 03:11 AM In reply to

    Re: InfoPath 2003 Rich Text Box line seperation

     

     Hi All,

    I found a solution for this issue..

    I used following code

     DOMDocument50 xmldoc = new DOMDocument50();
     XmlNamespaceManager nm = GetNamespaceManager();
     xmldoc.setProperty("SelectionNamespaces", "xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2010-02-08T11-28-21'     xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'");

     xmldoc.async= false;
     xmldoc.validateOnParse = false;
     xmldoc.loadXML(xmlNode.OuterXml);
     domNode = (IXMLDOMNode)xmldoc;

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