How to insert section break inside a content control using c# code

My requirement is here . I have multiple input documents and I have to generate one output document coping data from input docs . So II am coping all sections from source files into one content control in target file .
Each input document has multiple sections , where each section can be either portrait or landscape mode
I want to copy as it is in source to target document 's content control.
The problem is for all section default page orientation is applied in target document .
I am trying to insert section break after inserting a section , so each section can be update with respective orientation as in source document.,but section break is inserted outside of parent content control .
Can anyone help me how this will be possible in Aspose ?
Rasmi Ranjan Mishra


Thanks for your inquiry. Document.ImportNode method that makes a copy of the original node and updates all internal document-specific attributes, Please check the following code example.

// source document 1
Document sourcedoc1 = new Document(dataDir + "sourceDocument.doc");
// source document 2
Document sourcedoc2 = new Document(dataDir + "sourceDocument2.doc");
// desination document
Document dstDoc = new Document();

// clone doc 1 sections into destination document
foreach (Section sourceSection in sourcedoc1.Sections)
    Section newSection = (Section)dstDoc.ImportNode(sourceSection, true);

// clone doc 2 sections into destination document
foreach (Section sourceSection in sourcedoc2.Sections)
    Section newSection = (Section)dstDoc.ImportNode(sourceSection, true);

dataDir = dataDir + "Document.Copy_out.doc";

Please also share your sample source and target files and may also share your sample source code logic for your more specific scenario solution.