Regarding Novacode Docx: How to Add Soft Returns to Paragraphs

I am using the Novacode DocX C # library to create text documents and ran into a problem. I want my paragraphs to "stick together" on page breaks. But I also want to use soft returns so that my images appear vertically between lines of text.

So my question is: how to add soft returns to paragraphs?

+8
c # ms-word novacode-docx
source share
1 answer

You can try adding one of these unicode char at the end of your paragraph, for example:

using (DocX document = DocX.Create(@"docs\myDoc.docx")) { Paragraph p = document.Paragraphs[0]; p.Append("\u000D"); p.Append("\u000A"); } 

Tell me if your problem solves

0
source share

All Articles