I have C# code that I am using to write entries in a Notes database. Below is a simple example of the kind of thing I am doing.
var text = "Line 1\r\nLine 2\r\nLine 3"; doc.ReplaceItemValue("Body", text); doc.Save(false, false);
I would expect that when I view the document in Notes, I would see the body formatted as follows:
Line 1 Line 2 Line 3
However, Notes seems to eat up the newline characters, and what I actually see is this:
Line 1Line 2Line 3
I have tried using
\n as well, but that doesn't make any difference in the formatting I observe in Notes.
I don't do a lot of Notes programming, so I'm a little confused as to why this is not working for me, since every example I have come across is similar to my code.
var text = "Line 1" + CHAR(10) + "Line 2" + CHAR(10) + "Line 3"- Anurag Ranjhan 2012-04-03 21:26
If you want to add new lines in the body of a document, you can use the NotesRichTextItem methods as follows:
//(note this is pseudo-code as I'm typing this from memory) var richTextItem = new NotesRichTextItem(doc, "Body") richTextItem.AppendText("Line 1"); richTextItem.AddNewLine(1); doc.Save(false,false);
If it is a simple text field, define it as a multivaluefield in the notes form and then you could do something like
dim item as notesitem set item = doc.replaceitemvalue("Body","Line 1") call item.appendToTextlist("Line 2") call item.appendToTextList("Line 3")
This looks a lot like the newline issue that the java API had before 8.5. You should be able to add newlines into any text item, not just RichText and not using hacks like messing about with lists.
Prior to the fix in 8.5 one workaround was to use the
session.evaluate to manipulate the text in formula language.