Problem copying sections related to each other

Following the suggestions in this forum I am successfully merging several documents into one by copying the sections from the originals into the new document.

The problem comes when trying to copy the sections from document A into document b and having the sections from A retain their relative position to one another. Each section is instead placed onto its own page. Since the user has designed a relatively complex page with the layout done with columns and sections, this one page in the original turns into a large number of pages in the outbound document.

Is there a way to copy a number of sections at once, retaining layout, between one document and another?

Your help is greatly appreciated.

Brian

Hi Brian,

Do I understand you correctly that each copied section starts at new page instead of being continuous and that’s the issue?

that is the issue exactly Sad The user has created a complex page with a number of sections on the page… and when moving them their relationship to each other is lost. Is there a way to copy a group of sections or some such?

Thanks,
Brian

When copying sections, use the following line of code (highlighted with bold) to specify that the section being inserted must be continuous:

for (int i = 0; i < srcDoc.Sections.Count; i++)
{
Section section = (Section)dstDoc.ImportNode(srcDoc.SectionsIdea, true);
section.PageSetup.SectionStart = SectionStart.Continuous;
dstDoc.Sections.Add(section);
}

Thank you very much. I’ll give this a try in a minute and let you know how it goes.

Brian