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.
Unfortunately, activation email could not send to your email. Please try again.

Replace a plain text with a template doc.

Thread ID:

Created:

Updated:

Platform:

Replies:

70371 Dec 10,2007 05:21 AM Dec 12,2007 05:59 AM ASP.NET Web Forms (Classic) 3
loading
Tags: DocIO
Josue Medrano
Asked On December 10, 2007 05:21 AM

I've an evaluation version of DocIO, I am trying to accomplish some requirements, so far most of then are fulfilled, however I'd like to expose the following questions:

Is it possible find a plainText for instance:
PlaceHolder99 and replace with a existing template.

I saw a example of your, but this example does firs a find a in the source template, collects the text and then replaces with this selected text. What I am looking for is to to replace this plain text by this source template.

Sample:

docMaster.Open(Path.Combine(dataPath, "TemplateMaster.doc"), FormatType.Doc);
docSource1.Open(Path.Combine(dataPath, "TemplateSource1.doc"), FormatType.Doc);
docMaster.Replace(new Regex("PlaceHolder1"), <>);


Thanks a lot for your help.
Regards
Joshua




Fathima Shalini P [Syncfusion]
Replied On December 11, 2007 05:39 AM

Hi Joshua,

Thanks for your interest in Syncfusion Products.

Please do find the sample in the following link.

http://websamples.syncfusion.com/samples/DocIO.Windows/F70371/main.htm

This sample finds the text in source template and replaces with the text in the sample source template. If I have misunderstood your requirement could you please explain me in detail, so that I can work in depth and try to send a better solution.

Please let me know if any questions regarding.

Regards,
Fathima.


Josue Medrano
Replied On December 11, 2007 10:21 AM

Hi Fathima,
What I need to accomplish is Insert a document(Template2) into another document(Template1) at a specific place.
I don't want to search any specific text in document in (Template2).

For instance:
I have two templates DOC1.doc and DOC2.doc.
I have plain Text in DOC1 named " [%Placeholder1%] " which I want to replace it with the hole content of DOC2.doc

Is it possible to do this?.

I appreciate very much your help.

Best Regards
Joshua



>Hi Joshua,

Thanks for your interest in Syncfusion Products.

Please do find the sample in the following link.

http://websamples.syncfusion.com/samples/DocIO.Windows/F70371/main.htm

This sample finds the text in source template and replaces with the text in the sample source template. If I have misunderstood your requirement could you please explain me in detail, so that I can work in depth and try to send a better solution.

Please let me know if any questions regarding.

Regards,
Fathima.




Bhuvaneswari P [Syncfusion]
Replied On December 12, 2007 05:59 AM

Hi Joshua,

Thanks for the update.

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



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;