Click or drag to resize

ContentDisposition Enumeration

Enumerates different ways of presenting the document at the client browser.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.2
Syntax
public enum ContentDisposition
Members
  Member nameValueDescription
Attachment0 Send the document to the browser and present an option to save the document to disk or open in the application associated with the document's extension.
Inline1 Send the document to the browser and presents an option to save the document to disk or open inside the browser.
Remarks

Note that the actual behavior on the client browser might be affected by security configuration of the browser.

Examples
Performs a simple insertion of data into merge fields and sends the document to the browser inline.
// Open an existing document
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertField(" MERGEFIELD FullName ");
builder.InsertParagraph();
builder.InsertField(" MERGEFIELD Company ");
builder.InsertParagraph();
builder.InsertField(" MERGEFIELD Address ");
builder.InsertParagraph();
builder.InsertField(" MERGEFIELD City ");

// Fill the fields in the document with user data
doc.MailMerge.Execute(new string[] { "FullName", "Company", "Address", "City" },
    new object[] { "James Bond", "MI5 Headquarters", "Milbank", "London" });

// Send the document in Word format to the client browser with an option to save to disk or open inside the current browser
Assert.That(() => doc.Save(response, "Artifacts/MailMerge.ExecuteArray.doc", ContentDisposition.Inline, null), 
    Throws.TypeOf<ArgumentNullException>()); //Thrown because HttpResponse is null in the test.

// The response will need to be closed manually to make sure that no superfluous content is added to the document after saving
Assert.That(() => response.End(), Throws.TypeOf<NullReferenceException>());
See Also