Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
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#
Wiki Markup
{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.{excerpt}
{signature: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)
Parameters
{signature}
{parameters}
{param:workbook}A [Workbook|Workbook] object representing the workbook to save.{param}
{param:response}A {msdn:System.Http.Response
|System.Http.Response
} object, usually  [Page.Response
.
Param
workbookworkbook

A Workbook object representing the workbook to save.

Param
responseresponseA
Msdn
1System.Http.Response
Param
fileNamefileName

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
openInBrowseropenInBrowser

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

Exceptions
|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#}
ExcelApplication xla = new ExcelApplication();
Workbook wb = xla.Create();

//--- Do something here
xla.Save(wb, Page.Response, "generated.xls", false);
{code}
{code:vb.net
|title=vb.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}
Exception
System.ExceptionSystem.Exception

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

Exception
System.ArgumentExceptionSystem.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
csharpcsharp
titleC#
Code Block
vb.nettitle