Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regarding Novacode Docx: How do I add soft returns within paragraphs

I am using the Novacode DocX c# library to create word documents and have run into a problem. I want my paragraphs to 'keep together' at page breaks. But, I also want to use soft returns to force my pictures to display vertically between lines of text.

So my question is, how do I add soft returns within paragraphs?

like image 255
Darin Sease Avatar asked May 30 '17 19:05

Darin Sease


1 Answers

You can try to add one of those unicode char at the end of your paragraph, for instance :

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

Tell me if it solves your problem

like image 147
G.Dealmeida Avatar answered Oct 03 '22 11:10

G.Dealmeida