Why name the document when saving to browser


I have a very basic question.

When you save a document, via the method below, what is the purpose of naming the document ie: Report.doc? When the document comes up in the browser the title of the browser window is that which is defined in the web form's property page. If I modify the document in the browser and attempt to exit the browser, I am presented with a dialog asking if I want to save the document. The default name of the document in the save dialog is once again the title of the web form not Report.doc. Report.doc does not seem to be meaningful. I really would like to name the document, so that when I save it to local disk, the dialog has *that* name as the *default* name for saving. IE: I would like to drive the save dailog into using Report.doc as the default name for saving.

doc.Save("Report.doc", SaveFormat.FormatDocument, SaveType.OpenInBrowser, Response)



The document filename is written to the HTTP response header using standard approach:

if(saveType == SaveType.OpenInWord)

response.AddHeader("content-disposition","attachment; filename=" + fileName);


response.AddHeader("content-disposition","inline; filename=" + fileName);

When I execute the mentioned line of code, the filename does present in the save dialog and when I click the Save as button and the new dialog gets opened, the name is set by default in the filename textbox. However, if I do like you describe, the passed filename indeed seems to be ignored. That appears to be standard browser behaviour and we have nothing to do with it.


Thank you for the explanation and sample code. I guess that raps it up. Now for the big purchase.

Thank you.

I will get back to you during the upgrading from demo to purchase version I am sure.



PS I used CustomDocumentProperties to store user prompts we discussed previously ie: *value* is the prompt to the user and *name* is a reference to the mergefiled inserted into the document. I collect up all of the CustomDocumentProperties (names and values) with an inital read of the document and then I present the user with a seperate page of the prompts so that the reponses to the prompts can be typed into textboxs. I then mailmerge the document with the contents of the textboxs. Pure simplicity. Just another example of how elegant aspose.words really is. By using CustomDocumentProperties, every document contains it's own prompts to the user. The seperate prompt page dynamically adds labels and textboxes as the CustomDocumentProperties dictates.