Duplicated pages.

I have a word template with 3 pages
1 and 3 are fixed
The 2 brings reserved words to replace and an image that must also be replaced
I need that page 2 to be duplicated n number of times (The number varies) and each time it is duplicated, replace the reserved words with different data and the same image


This will depend on the way how that page is defined, does it come from a section break or a page break?

Anyway, please send us your Word template so that we can investigate it.

Sure. I have passed the DOCX WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free

Here is how you can duplicate this content and replace those reserved words:

var document = DocumentModel.Load("Plantilla.docx");

var pageBreaks = document.GetChildElements(true, ElementType.SpecialCharacter)
    .Where(sc => sc.CharacterType == SpecialCharacterType.PageBreak)

int duplicateCount = 5;
var range = new ContentRange(pageBreaks[0].Content.End, pageBreaks[1].Content.End);
for (int i = 0; i < duplicateCount; i++)

int counter = 1;
foreach (var content in document.Content.Find("[NUM]"))
    content.LoadText("NUM" + counter++);

counter = 1;
foreach (var content in document.Content.Find("[place]"))
    content.LoadText("Place " + counter++);


But instead of this, I would recommend you try using a mail merge process to achieve the same.
For example, check this input file:

I’ve defined the “MyData” merge range that starts on top of the second page and ends on top of the third page and then I just execute the mail merge with some data.
The process will copy the merge range for each record in the data source and it will replace the MERGEFIELD elements with appropriate values from the data source.

var source = new
    MyData = new[]
        new { Num = 1, Place = "Place 1", View = "View 1", Tamano = "Tamano 1" },
        new { Num = 2, Place = "Place 2", View = "View 2", Tamano = "Tamano 2" },
        new { Num = 3, Place = "Place 3", View = "View 3", Tamano = "Tamano 3" },
        new { Num = 4, Place = "Place 4", View = "View 4", Tamano = "Tamano 4" }

var document = DocumentModel.Load("Plantilla-with-MailMerge.docx");

Here is the output document: