Excerpt |
---|
Opens an Excel workbook from a stream and returns a Workbook object. |
Signature |
---|
C# | C# | Wiki Markup |
---|
{description}
{excerpt}Opens an Excel workbook from a stream and returns a [Workbook|Workbook] object.{excerpt}
{signature:C#}
public virtual Workbook Open(System.IO.Stream stream)
|
Signature |
---|
{signature}{signature:vb.net | vb.net | }
Public Overridable Function Open(ByVal stream As System.IO.Stream) As Workbook
|
Param |
---|
stream | stream | A {signature}
{parameters}
{param:stream}A System.IO.Stream containing a OOXML format \(Excel 2007 or later\) .xlsx or BIFF8 format \(Excel 97 or later\) .xls file. |
Returns |
---|
A Workbook object representing the file opened. |
...
If the file cannot be found or opened, or if the file is not a OOXML format (Excel 2007 or later) .xlsx or BIFF8 format (Excel 97 or later) .xls file.
Remarks |
---|
ExcelWriter supports Excel's OOXML (Excel 2007 or later) and BIFF8 (Excel 97 or later) format only. Do not use this method to open BIFF7 (Excel 95) files. |
Example |
---|
Code Block |
---|
| csharp | csharp |
title | C# |
---|
{param}
{returns}A {{Workbook}} object representing the file opened.{returns}
{exceptions}
{exception:System.Exception}If the file cannot be found or opened, or if the file is not a OOXML format \(Excel 2007 or later\) .xlsx or BIFF8 format \(Excel 97 or later\) .xls file.{exception}
{remarks}ExcelWriter supports Excel's OOXML \(Excel 2007 or later\) and BIFF8 \(Excel 97 or later\) format only. Do not use this method to open BIFF7 \(Excel 95\) files.
{remarks}
{example}{code:csharp|title=C#}
ExcelApplication xla = new ExcelApplication();
FileStream fStrm = new FileStream(@"C:\Sales\2003\June.xlsx", FileMode.Open);
Workbook wb = xla.Open(fStrm);
Code Block |
---|
{code}
{code:vb.net
vb.net | title | |title=vb.net
}
Dim xla As New ExcelApplication()
Dim fStrm As FileStream = New FileStream("C:\Sales\2003\June.xlsx", FileMode.Open)
Dim wb As Workbook = xla.Open(fStrm)
{code}
{example}