Version

Save(Stream,IPackageFactory) Method

Writes the workbook to a stream.
Syntax
'Declaration
 
Public Overloads Sub Save( _
   ByVal stream As Stream, _
   ByVal packageFactory As IPackageFactory _
) 
public void Save( 
   Stream stream,
   IPackageFactory packageFactory
)

Parameters

stream
The stream to write the workbook to.
packageFactory
An IPackageFactory which can be used to open an IPackage from a stream.
Exceptions
ExceptionDescription
System.ArgumentNullExceptionstream is null.
System.InvalidOperationExceptionThe workbook has no worksheets in its Worksheets collection.
System.InvalidOperationExceptionNo worksheet in this workbook's Worksheets collection has its DisplayOptionsBase.Visibility set to Visible.
System.InvalidOperationExceptionA CustomView in the workbook's CustomViews collection has all worksheets hidden. At least one worksheet must be visible in all custom views.
Remarks

The workbook will be written in the format specified by the CurrentFormat.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also