Free Support Forum - aspose.com

Using Aspose.Word to manipulate an existing word document

Hi,


I am evaluating Aspose.word at the moment and am wondered whether they following would be possible.

Can I use an existing word document and use this as a template to build a report using the documentBuilder to manipulate this template.

Say for example I have a word document that conatins the following:-

Dear NAME

We are writing to you NAME to tell you about OUR_PRODUCT. For more info on our OUR_PRODUCT please do something.

Could I then use aspose.word to open this file and hunt down all instances of NAME in the template and replace with Joe Bloggs, and then replace all instances of OUR_PRODUCT with Acme Ltd

Then using Document Save to save the new personalised document?

I am also guessing that I could use Aspose Cells to generate graphs and charts which I could then insert into my report.

Any information would be greatly appeciated.

Regards

Iain




Hi

Thanks for your request. Sure you can achieve this. You can use Range.Replace method to replace placeholders with values:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.range.replace_overloads.html

But, I think, you should better use Mail Merge feature:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/simple-mail-merge-explained.html

Hope this helps.

Best regards,