Hi-
I have an applicaiton where I am reading multiple documents stored on a web server (under App_Data directory), replacing their bookmarks with data from the database and returning them to the user. Unfortunately only 1 document is being returned into the Response stream whereas I would like for all the documents to be returnd to the user so that the user can either save them or open them in MS Word for viewing. Here is the code that I am using:
private void GenerateDocuments(IEnumerable endorsements, Dictionary submissionData)
{
foreach (var endorsement in endorsements)
{
string filePath = string.Empty;
filePath = Path.Combine(Server.MapPath(endorsement.DocumentPath),
endorsement.DocumentName);
Document doc = new Document(filePath);
foreach (Bookmark bookmark in doc.Range.Bookmarks)
{
string key = bookmark.Name;
if (submissionData.ContainsKey(key))
{
bookmark.Text = (submissionData[key] == null) ? string.Empty :
submissionData[key].ToString();
}
}
doc.Save(endorsement.DocumentName, SaveFormat.Doc, SaveType.OpenInWord, Response);
}
}
Any idea how I can get this to work?
Thanks in advance,
Ali