I have C# code that loops through a list of records from a database and inserts them in a
numbered list such as:
- My First Line
- My Second Line
- My Third Line
etc…
Some of these records have non-printable characters which are ‘\n’, the newline character. If
such a record has text such as:
“I have a cat\n I have a dog \n I have a horse”
When my code creates the list this record should appear in the document as:
- I have a cat
I have a dog
I have a horse - Next record
- Next record
etc
Instead it appears as:
- I have a cat
- I have a dog
- I have a horse
- Next record
- Next record
etc
Right now I have the following code to strip out the ‘\n’:
myString = myString.Replace('\n', ' ');
However that makes the list look like this:
- I have a cat I have a dog have a horse
- Next record
- Next record
etc
When in Word, I would type a Shift + Enter to get that line break. How can I do that when creating my list ? What do I need to replace the ‘\n’ with and get the proper line break that does not increment the number in the list ?