Question

I need to process a huge amount of word documents in order to replace the content of the document between 2 section breaks.

Basically the document is structured like the following :

Content    
========= Continuous Section Break ==========
Content with 2 columns
========= Continuous Section Break ==========
Content

I already know how to detect the breaks in the document

using (WordprocessingDocument myDoc = WordprocessingDocument.Open(filename, true)) 

{ 

MainDocumentPart mainPart = myDoc.MainDocumentPart; 

List<Break> breaks = mainPart.Document.Descendants<Break>().ToList(); 

// TODO replace content between the breaks 

mainPart.Document.Save(); 

} 

But I don't know how to replace the content between them.

Any Help appreciated.

Was it helpful?

Solution

I solved my problem by using the OpenXML Power Tools as explained in this link.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top