Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0
Description

Excerpt

Saves a specified Workbook as a  OOXML format (Excel 2007 or later) .xlsx or  BIFF8 format (Excel 97 or later) .xls file.

Signature
C#C#
Wiki Markup
{description}
{excerpt}Saves a specified [Workbook|Workbook] as a  OOXML format (Excel 2007 or later) .xlsx or  BIFF8 format (Excel 97 or later) .xls file.{excerpt}
{signature:C#}
 public virtual void Save(Workbook workbook, System.String fileName)
Signature
{signature}{signature:vb.net
vb.net
}
Public Overridable Sub Save(ByVal workbook As Workbook, ByVal fileName As String)
Parameters

...

A Workbook object representing the workbook to save.

...

Specifies a complete path and file name for the Workbook. ExcelWriter will save the file to this location. If a file with the same name exists, it will be overwritten by the new Excel file.

Exceptions
{signature}
{parameters}
{param:workbook}A {{Workbook}} object representing the workbook to save.{param}
{param:fileName}Specifies a complete path and file name for the Workbook. ExcelWriter will save the file to this location. If a file with the same name exists, it will be overwritten by the new Excel file.{param}
{exceptions}
{exception:System.Exception}If there is a problem creating, opening, or writing to the file specified, or reading from the workbook 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 oExcelApp = new ExcelApplication();
Workbook wb = oExcelApp.Create(ExcelApplication.FileFormat.Xlsx);
oExcelApp.Save(wb,@"C:\Sales2003\June.xlsx");
{code}
{code:vb.net
|title=vb.net
}
Dim oExcelApp As New ExcelApplication()
Dim wb As Workbook = oExcelApp.Create(ExcelApplication.FileFormat.Xlsx)
oExcelApp.Save(wb, "C:\Sales2003\June.xlsx")
{code}

{example}
Exception
System.ExceptionSystem.Exception

If there is a problem creating, opening, or writing to the file specified, or reading from the workbook 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