Lost of RTF fomatting - InfoPath Dev
in

InfoPath Dev

Lost of RTF fomatting

Last post 12-20-2010 05:09 AM by pavelbacka. 8 replies.
Page 1 of 1 (9 items)
Sort Posts: Previous Next
  • 12-10-2010 03:40 AM

    Lost of RTF fomatting

    Hi, I am totally beginner, so here is the issue. I tried it do it in 2007 version, but it didnt worked, so I hoped, that in 2010 it will, but .... no. I have one form, where I am putting data from the list, where I created RTF field and somehow formated text in this field (column). But after I transfer it into form, formatting will disappear. I dont know, what to do, please give me some advice. The thing is, that I most probably cant write code, but if it is only option, maybe I can talk to my boss. Thanks a lot.
  • 12-10-2010 06:52 AM In reply to

    Hi, by defaut you can't get rich text from Sharepoint with a data connection as you see it's just give you a field as plain text. I know some trick for that but it requires codes.

  • 12-10-2010 07:14 AM In reply to

    Hmm, I thaught it. So, lets try the "code" way :) Can you please try to explain it to me detaily? A founded something but I am not cleverer. :/
  • 12-10-2010 07:30 AM In reply to

    Ok, I try to explain it first you have to strore on your Sharepoint field your xhtml code in plain text

    ie:<div><b>My text</b></div>

    After that you can use this to set a Rich text field programatically. here a post will explain that :

    http://www.bizsupportonline.net/infopath2007/how-to-programmatically-get-set-xhtml-rich-text-infopath.htm

  • 12-10-2010 07:50 AM In reply to

    Thanks, this is what I meant. I dont know where to put this code. Now I am not near computer, so on Monday, I am back, and hope, that we can make it :) So, have a nice weekend ;)
  • 12-12-2010 11:01 PM In reply to

    Ok, here I am. The thing is, where exactly put this code and what should I do, with this string (xhtmlRTFField)?:

    If you have a Rich Text Box control named rtfField on an InfoPath form template and would like to get the XHTML code for this field and store it in a string variable named xhtmlRTFField, you could use the C# code:

    XPathNavigator domNav = MainDataSource.CreateNavigator();
    string xhtmlRTFField = domNav.SelectSingleNode("//my:rtfField", NamespaceManager).InnerXml;

    I am totaly lost :/. I do some programing, but here, I am lost.

    And another thing, what have to be allowed on server (or anywhere), that this code will be accepted (if it is required).
    Thanks a LOT
  • 12-13-2010 10:41 AM In reply to

    Hi, I don't know exactly what you want to do on you form, in my case when I select on a drop down wich is bind to a sharepoint list I set some RT value to my Infopath Field. So I set an "On Changed" event on my drop down field and I usesome code to populate my RT field.

  • 12-14-2010 12:51 AM In reply to

    Here is what I need: http://imgur.com/XbVSF.png To choose in dropdown menu some title from list and to fill in Body from list with already formated text. No big deal, this should be default behavior :/

    Here is Formula of body:
    xdXDocument:GetDOM("MeetingTypes")/dfs:myFields/dfs:dataFields/dfs:MeetingTypes/@Body[xdXDocument:get-DOM()/my:myFields/my:Type = ../@Title]
    And this formula I cant verify: Function 'GetDOM' did not return a vaule, or it returned a value that cannot be converted to an XSL data type
    How can I know which of this it is?

    And here is VB code:
    Private Sub InternalStartup(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Startup
    AddHandler EventManager.XmlEvents("/my:myFields/my:Type").Changed, AddressOf Type_Changed
    End Sub
    Public Sub Type_Changed(ByVal sender As Object, ByVal e As XmlEventArgs)
    Dim domNav As XPathNavigator = MainDataSource.CreateNavigator()
    Dim xhtmlRTFField As String = domNav.SelectSingleNode("//my:Body", NamespaceManager).InnerXml
    End Sub


  • 12-20-2010 05:09 AM In reply to

    Hi, so ... I am back :) I had some troubles with our production SP server, so the give me access to development server, where I can play. Now it is not throwing any errors, but it is not working properly.

    In Drop-Down list named Title works everything fine. It is loading values from field in SP List.
    In RTF Body it is worse. Here is formula from Default Value:
    xdXDocument:GetDOM("MeetingTypes")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Body[xdXDocument:get-DOM()/my:myFields/my:Title = xdXDocument:GetDOM("MeetingTypes")/dfs:myFields/dfs:dataFields/d:SharePointListItem_RW/d:Title]
    To Code editor I added this code:
    Private Sub InternalStartup(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Startup
    AddHandler EventManager.XmlEvents("/my:myFields/my:Title").Changed, AddressOf Type_Changed
    End Sub

    Public Sub Type_Changed(ByVal sender As Object, ByVal e As XmlEventArgs)
    Dim domNav As XPathNavigator = MainDataSource.CreateNavigator()
    Dim xhtmlRTFField As String = domNav.SelectSingleNode("//my:Body", NamespaceManager).InnerXml
    End Sub

    But when I publish this and start it, I can select some value from rows in SP List, but to body it will insert value from Body column (from SP List) from first row. And it is not formated.

    Do you know, where should be problem? Thanks
Page 1 of 1 (9 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.