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..