using Novacode; // Create a new document DocX document = DocX.Create("MyDocument.docx"); // Add a paragraph to the document Paragraph p = document.InsertParagraph(); // Set the text of the paragraph p.Append("This is a new paragraph."); // Save the document document.Save();
using System.Windows.Controls; // Create a new text block TextBlock tb = new TextBlock(); // Add a paragraph to the text block Paragraph p = new Paragraph(); tb.Inlines.Add(p); // Set the text of the paragraph p.Inlines.Add("This is a new paragraph."); // Add the text block to a window or another container myWindow.Children.Add(tb);In both examples, the Paragraph Add function is used to create a new paragraph and add it to a document or text block. The package libraries used are the DocX library and System.Windows.Controls library respectively.