Modifing rtf fields - InfoPath Dev
in

InfoPath Dev

Modifing rtf fields

Last post 05-15-2006 05:57 AM by Coita Thierry. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 05-14-2006 02:09 AM

    Modifing rtf fields

    Hello !

    Sorry, I am Italian and I speak english very little.

    I work with InfoPath, but I have one problem.

    In Javascript, I wish modify the content in rtf fields, without lose the formatting.

    Using rtf fields with normal method for node xml (selectSingleNode, ecc.) it's no good !

    Have you same ideas ?

    Thank you.
  • 05-15-2006 12:26 AM In reply to

    Hi,

    If you don't want to loose your formatting in a RTF field you must copy the node and not the value of this field with .text (string) property.

    For example and can use replaceNode for copy your XHTML content in a RTF.

    ++

    Thierry
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 05-15-2006 12:50 AM In reply to

    Thank you.

    Can you show me an example ?

    Remember, I'm working in an infopath context !
  • 05-15-2006 02:26 AM In reply to

    Sorry I work only in C# but in jcript only the name change:

    IXMLDOMDocument2 RTFXML = (IXMLDOMDocument2)thisXDocument.CreateDOM();
    RTFXML.loadXML("<RTF>" + "your string with xthml value" + "</RTF>");
    //The new node must have the correct markup (RTF in this case)
    IXMLDOMNode RTF = RTFXML.selectSingleNode("/RTF");
    IXMLDOMNode OldNode= thisXDocument.DOM.selectSingleNode("Root/RTF");
    //You can made a replace, a append or a insertBefore:
    thisXDocument.DOM.selectSingleNode("/Root").replaceChild(RTF(yournewIXMDOMNode), OldNode(the Old that you want to replace));
    //or
    thisXDocument.DOM.selectSingleNode("/Root").appendChild(RTF);
    //or
    thisXDocument.DOM.selectSingleNode("/Root").insertBefore(RTF(yournewIXMDOMNode), OldNode(the node where you want to insert before)

    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
  • 05-15-2006 04:26 AM In reply to

    Virgul, sorry !

    I give this error:

    Elemento "testo1" imprevisto in base al modello di contenuto dell'elemento principale "http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-04-12T12:59:11}modello.
  • 05-15-2006 05:57 AM In reply to

    You must select the top-level element for insert replace or insertbefore

    in my example the xml is like this:
    <Root><RTF/></Root>


    Your error is because you try to insert not in the good place or if you try to insert an element that don't has the correct name!

    your error message is You can't insert testo1 in modello because your schema don't allow this!!!
    What you try to make is:
    <Modello><testo1/><Modello>
    Infopath 2007, Langage: C#2.0 (Modèle Objet 2003)
    merci de lire ceci
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.