+ Start a Discussion

Rendering Attachment Body dynamically using MailMergeTemplates

Hello Friends,


I am facing an issue with creating attachments where i dynamically create the body using some list of records which have a summarized information. I am doing this with APEX code.


The issue here is that, the attachment type i am creating is a Word Doc and the content which gets rendered as part of the attachment body comes in a very poor display as i cannot format it in the code.


So, i tried using a MailMerge Template, so that i can then plug-in the data into this template which will look better. But somehow, when i add my contents into the template and create an attachment, it starts giving an error, that file format is corrupted etc....


Is there something which i am missing? Or, can someone give me some ideas on how can i achieve this apart from using MailMergeTemplates??


I need a generic solution to this ..... Would be great if someone can help me out here!!


Many Thanks,