Spread Silverlight Documentation
OpenExcel(Stream) Method
Example 


The stream that contains the Excel Compound Document File.
Opens an Excel Compound Document File and loads it into GcSpreadSheet.
Syntax
'Declaration
 
Public Overloads Sub OpenExcel( _
   ByVal stream As System.IO.Stream _
) 
'Usage
 
Dim instance As Workbook
Dim stream As System.IO.Stream
 
instance.OpenExcel(stream)
public void OpenExcel( 
   System.IO.Stream stream
)

Parameters

stream
The stream that contains the Excel Compound Document File.

Return Value

Whether the file opened successfully.
Exceptions
ExceptionDescription
System.ArgumentNullExceptionNo stream is specified or the specified stream is null.
System.ArgumentExceptionNo stream is specified or the specified stream is empty.
Remarks
For performance considerations, this method suspends all events during a file load.
Example
This example opens a file using the Workbook class.
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Filter = "Excel File (.xls)|*.xls";
bool? useClick = openFileDialog.ShowDialog();
if (useClick == true)
{
    var stream = openFileDialog.File.OpenRead();
    stream.Seek(0, System.IO.SeekOrigin.Begin);
   GrapeCity.Windows.SpreadSheet.Data.Workbook test = new GrapeCity.Windows.SpreadSheet.Data.Workbook(2);
    test.OpenExcel(stream);
    stream.Dispose();
}
Dim openFileDialog = New OpenFileDialog()
        openFileDialog.Filter = "Excel File(.xls)|*.xls"
        Dim useClick As Boolean = openFileDialog.ShowDialog()
        If (useClick = True) Then
            Dim stream = openFileDialog.File.OpenRead()
            stream.Seek(0, IO.SeekOrigin.Begin)
            Dim test As New GrapeCity.Windows.SpreadSheet.Data.Workbook(2)
            test.OpenExcel(stream)
        End If
Requirements

Target Platforms: Windows 7, Windows 8 Desktop, Windows Vista SP1 or later, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

Reference

Workbook Class
Workbook Members
Overload List

 

 


Copyright © GrapeCity, inc. All rights reserved.