How can I replace line breaks with nothing/an empty string?

Jan 3, 2014 at 7:24 PM
I'm trying this:
        private void ReplaceLineBreaksWithBoo(string filename)
        {
            List<string> lineBreaks;
            using (DocX document = DocX.Load(filename))
            {
                lineBreaks = document.FindUniqueByPattern("\n", System.Text.RegularExpressions.RegexOptions.None);
                if (lineBreaks.Count > 0)
                {
                    foreach (string s in lineBreaks)
                    {
                        document.ReplaceText(s, "boo!");
                    }
                }
                document.Save();
            }
        }
...but don't know what I need for the first arg to the FindUniqueByPattern() method.

Also, will this (once it's working) "draw up" my paragraphs, so that there are no lines between them? I don't want that. I might have to:

0) Prepend some "marker" before each paragraph
1) Remove the line breaks
2) Replace the marker in step 0 with a line break

Ideas?