Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

Streams the specified workbook to the client. It should be the only method that uses the response object, as it automatically sets response headers, clears the body of the response, and flushes it to the client.

Signature
C#
C#
 public virtual void Save(Workbook workbook, System.Web.HttpResponse response, System.String fileName, boolean openInBrowser)
{signature}{signature:
}
Signature
vb.net
vb.net
Public Overridable Sub Save(ByVal workbook As Workbook, ByVal response As System.Web.HttpResponse, ByVal fileName As String, ByVal openInBrowser As Boolean)
{signature}
{parameters}
{param:workbook}A [Workbook|Workbook] object representing the workbook to save.{param}
{param:response}A {msdn:
Parameters
Param
workbook
workbook

A Workbook object representing the workbook to save.

Param
response
response

A

Msdn
System.Http.Response

|

System.Http.Response

}

1System.Http.Response
object,

usually

[

Page.Response

|Page.Response].{param} {param:fileName}Specifies a file name for the workbook. This name will be displayed in the download dialog when the file is streamed to the browser.{param} {param:openInBrowser}If true, the spreadsheet will be opened in place in Internet Explorer, rather than spawning a seperate Excel window.{param} {exceptions} {exception:System.Exception}If there is an error obtaining the response stream from the Response object.{exception} {exception:System.ArgumentException}If the extension of the filename given is invalid for the given workbook. For example, a file created with Excel 2007, that has macros must be saved with the .xlsm extension{exception} {example}{code:csharp|title=C#}

.

Param
fileName
fileName

Specifies a file name for the workbook. This name will be displayed in the download dialog when the file is streamed to the browser.

Param
openInBrowser
openInBrowser

If true, the spreadsheet will be opened in place in Internet Explorer, rather than spawning a seperate Excel window.

Exceptions
Exception
System.Exception
System.Exception

If there is an error obtaining the response stream from the Response object.

Exception
System.ArgumentException
System.ArgumentException

If the extension of the filename given is invalid for the given workbook. For example, a file created with Excel 2007, that has macros must be saved with the .xlsm extension

Example
Code Block
csharp
csharp
titleC#

ExcelApplication xla = new ExcelApplication();
Workbook wb = xla.Create();

//--- Do something here
xla.Save(wb, Page.Response, "generated.xls", false);
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}

Dim xla As New ExcelApplication()
Dim wb As Workbook = xla.Create()

'--- Do something here
xla.Save(wb, Page.Response, "generated.xls", False)
{code} {example}