Preserve HTML formatting - InfoPath Dev
in

InfoPath Dev

Preserve HTML formatting

Last post 07-10-2006 07:20 PM by Matt Faus. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-05-2006 10:22 AM

    • epora
    • Not Ranked
    • Joined on 06-20-2006
    • USA
    • Posts 5

    Preserve HTML formatting

    Is there a simple way to preserve html formatting when passing a value using the DOM?

    optionContent = thisXDocument.DOM.getElementsByTagName("option4")[0].text

    Whenever I use the statement above, any font formatting, such as bolding, italisizing, and underlining, is stripped away and lost.

    The formatting is there however in the XML, which I can see in the InnerXml property in the following statement:


    XmlDocument xmlDocument = new XmlDocument();
    xmlDocument.LoadXml(thisXDocument.DOM.xml);

    string optionHTMLText = xmlDocument.FirstChild.NextSibling.NextSibling.NextSibling.InnerXml;

    Can anyone explain the reason for this and provide a remedy?

    Thanks,
    ~PGA
  • 07-10-2006 07:20 PM In reply to

    Re: Preserve HTML formatting

    That is simply how the Text and InnerXml properties are defined. If you use this statement I think you will get what you are looking for. If you are trying to display this in the form, say in a rich text box, you will have to actually add the HTML as a child node under the rich text node.

    optionContent = thisXDocument.DOM.getElementsByTagName("option4")[0].InnerXml

    I hope this helps, good luck!
    Matt Faus / Microsoft InfoPath MVP
    Qdabra® Software / Streamline data gathering to turn process into knowledge
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.