Cloning And Merging With Paragraphs

Hi,

Could you show me a sample code that does
Cloning And Merging With Paragraphs?

P.S. The clone section method works but we need to clone at the Paragraphs level


Thanks

Ho-Ching


1 Reply

BP Bhuvaneswari P Syncfusion Team April 18, 2007 01:08 PM UTC

Hi Ho-Ching Yung,

You can clone all the paragraphs from current section and merge it in to the new document by using the following code snippets:

[C#]

// Enumerate all the sections from the first template document.
IWSectionCollection secs1 = document1.Sections;

foreach (IWSection sec in secs1)
{
// Adding a new section to the newly created document.
doc.Sections.Add(new WSection (doc));
// Setting section break code to be the same as the template.
doc.LastSection.BreakCode = sec.BreakCode;
// Enumerating all the paragraphs in the current section.
IWParagraphCollection paragraphs = sec.Paragraphs;
// Cloning all the paragraphs from current section and merge it in to the new document.
foreach (IWParagraph paragraph in paragraphs)
doc.LastSection.Paragraphs.Add(paragraph.Clone(doc));
}

Here is the sample for your reference:

http://websamples.syncfusion.com/samples/DocIO.Web/4.4.0.51/33404/main.htm

Kindly let me know if you have any other questions.

Thank you for your interest in Syncfusion products.

Best Regards,
Bhuvaneswari

Loader.
Up arrow icon