Sequence contains no elements - on load template

Jul 31, 2012 at 3:25 AM

I am trying to generate a word document from a template. the idea is to:

1. load the template
2. replace mail merge fields with actual values.
3. generate a document to a specified directory.

when I try to load the template (which has a single line of text and one mai merge field), it throws a linq
exception - Sequence contains no elements.

If anyone has a sample on how to accomplish the above, it would be much appreciated.