Scenario/Problem: | Following
the procedures in the previous sections produces the change HTML but
does not apply rich text formatting to the entry. You therefore need to
apply rich text formatting to the entry. |
Solution: | Add code to append the Changes value. |
The last section of code in the method creates the
new entry, but the Changes field contains only text. For the rich text
to appear, the value needs to be appended to the Changes field. Add the
code in Listing 1 to the bottom of your method.
Listing 1. Apply Rich Text
//Apply Rich Text to new Element XPathNavigator repTable = MainDataSource.CreateNavigator(); XPathNodeIterator repTableRows = repTable.Select("/MY:MYFIELDS/ MY:GROUPTRACKCHANGES/MY:GROUPCHANGES", NamespaceManager); if (repTableRows.Count > 0) { int i = repTableRows.Count; repTable.SelectSingleNode ("/MY:MYFIELDS/MY:GROUPTRACKCHANGES/MY:GROUPCHANGES[" + i + "]/MY:CHANGES", NamespaceManager).SetValue(""); repTable.SelectSingleNode ("/MY:MYFIELDS/MY:GROUPTRACKCHANGES/MY:GROUPCHANGES[" + i + "]/MY:CHANGES", NamespaceManager).AppendChild(newValue); }
|
The code now produces the desired rich text within the rich text boxes, as shown in Figure 1.