We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Insert the hole content of a document into another document find/replace

Hi,

Is it possible to replace a placeholder with the hole content of another document.
in other words marge a word ducument into other in a desired place.

Thanks for your information.
Joshua



1 Reply

BP Bhuvaneswari P Syncfusion Team December 12, 2007 10:56 AM UTC

Hi Joshua,

Thanks for evaluating Syncfusion products.
Is it possible to replace a placeholder with the hole content of another document.in other words marge a word ducument into other in a desired place.?

Yes, it is possible to find the particular text in source document and replace it with the content of another whole document using TextBodyPart. You need to select the whole document using the tectBodySelection, then copy the selected text into the TextBodyPart.

The following code snippet illustrates this..

//Select text and image
TextBodyPart replacePart = new TextBodyPart(replaceDoc);

//Select the whole document
TextBodySelection textSel = new TextBodySelection(replaceDoc.LastSection.Body, 0, replaceDoc.LastSection.Paragraphs.Count,0,1);

//Copy the selected area into the TextBodyPart
replacePart.Copy(textSel);

//Replace Text with image and text.
doc.Replace("INSERT PARAGRAPH ITEMS", replacePart, false, true);

Please downlaod the sample from the below link which demonstrate the above concept
http://websamples.syncfusion.com/samples/DocIO.Windows/F70419/main.htm

Please take a look into the sample and let me know if this helps you.

Best Regards,
Bhuvana



Loader.
Live Chat Icon For mobile
Up arrow icon