I parse string to <![CDATA[{0}]]>
as below
string a = "<![CDATA[put returns between \r\n paragraphs \n for linebreak add 2 spaces <br/> at end]]>"
After I read a document (.docx) by WordprocessingDocument.
string docText = null;
using (StreamReader sr = new StreamReader(wordDoc.MainDocumentPart.GetStream()))
{
docText = sr.ReadToEnd();
}
docText = docText.Replace("needtochange", a);
using (StreamWriter sw = new StreamWriter(wordDoc.MainDocumentPart.GetStream(FileMode.Create)))
{
sw.Write(docText);
}
As result is "put returns between paragraphs for linebreak add 2 spaces at end" at the same line. It does not effect.