Spread WinRT Documentation
GrapeCity.Xaml.SpreadSheet.Data Namespace / ExcelOpenFlags Enumeration
Example Example


In This Topic
    ExcelOpenFlags Enumeration
    In This Topic
    Specifies what part of the Excel-compatible file to load into the spreadsheet.
    Syntax
    'Declaration
     
    <FlagsAttribute()>
    Public Enum ExcelOpenFlags 
       Inherits System.Enum
    'Usage
     
    Dim instance As ExcelOpenFlags
    [Flags()]
    public enum ExcelOpenFlags : System.Enum 
    Members
    MemberDescription
    ColumnHeadersLoads column headers from frozen rows in the Excel-compatible file into the spreadsheet.
    DataAndFormulasOnlyLoads formulas from the Excel-compatible file into the spreadsheet.
    DataOnlyLoads only the data from the Excel-compatible file into the spreadsheet.
    DoNotRecalculateAfterLoadAvoids recalculation after loading the Excel-compatible file (by not setting the SheetView.AutoCalculation property to true and not calling SheetView.Recalculate()).
    NoFlagsSetOpens the spreadsheet from the Excel-compatible file with no special options.
    RowAndColumnHeadersLoads row headers from frozen columns and column headers from frozen rows.
    RowHeadersLoads row headers from frozen columns in the Excel-compatible file into the spreadsheet.
    Example
    This example uses the ExcelOpenFlags enumeration.
    private async void Button_Click_1(object sender, RoutedEventArgs e)
            {
                try
                {
                    var filePicker = new Windows.Storage.Pickers.FileOpenPicker();
                    filePicker.FileTypeFilter.Add(".xls");
                    filePicker.FileTypeFilter.Add(".xlsx");
                    Windows.Storage.StorageFile storageFile = await filePicker.PickSingleFileAsync();
                    if (storageFile != null)
                    {
                        using (var stream = await storageFile.OpenStreamForReadAsync())
                        {                        
                            await gcSpreadSheet1.OpenExcelAsync(stream);
                            //await gcSpreadSheet1.OpenExcelAsync(stream, GrapeCity.Xaml.SpreadSheet.Data.ExcelOpenFlags.RowAndColumnHeaders);                        
                        }
                    }
                }
                catch (Exception ex)
                {
                    Windows.UI.Popups.MessageDialog dialog = new Windows.UI.Popups.MessageDialog(ex.Message, "Error");
                    dialog.ShowAsync();
                }                
            }
    Private Async Sub Button_Click_1(sender As Object, e As RoutedEventArgs)
            Try
                Dim filePicker As New Windows.Storage.Pickers.FileOpenPicker()
                filePicker.FileTypeFilter.Add(".xls")
                filePicker.FileTypeFilter.Add(".xlsx")
                Dim storageFile As Windows.Storage.StorageFile = Await filePicker.PickSingleFileAsync()
    
                If storageFile IsNot Nothing Then
                    Using stream = Await storageFile.OpenStreamForReadAsync()
                        await gcSpreadSheet1.OpenExcelAsync(stream)
                        'await gcSpreadSheet1.OpenExcelAsync(stream, GrapeCity.Xaml.SpreadSheet.Data.ExcelOpenFlags.RowAndColumnHeaders)                   
                        
                    End Using
                End If
            Catch ex As Exception
                Dim dialog As Windows.UI.Popups.MessageDialog = New Windows.UI.Popups.MessageDialog(ex.Message, "Error")
                dialog.ShowAsync()
            End Try
        End Sub
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             GrapeCity.Xaml.SpreadSheet.Data.ExcelOpenFlags

    See Also