I have a document that I am iterating thru getting the paragraphs. For each of these paragraphs I need to create a new document and save it. I can't figure out how to add a Paragraph from the source document to the new one.
foreach (var p in paragraphsFromSourceDocument)
{
using (var memoryStream = new MemoryStream())
{
var doc = WordprocessingDocument.Create(memoryStream, WordprocessingDocumentType.Document);
doc.AddMainDocumentPart();
// Create the Document DOM.
doc.MainDocumentPart.Document = new Document();
doc.MainDocumentPart.Document.Body = new Body();
//Add the paragraph 'p' to the Body here:
// HOW ?????????
doc.MainDocumentPart.Document.Save();
}
}