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


In This Topic
    ExcelSaveFlags Enumeration
    In This Topic
    Specifies what part of the spreadsheet to export to an Excel-compatible file.
    Syntax
    'Declaration
     
    <FlagsAttribute()>
    Public Enum ExcelSaveFlags 
       Inherits System.Enum
    'Usage
     
    Dim instance As ExcelSaveFlags
    [Flags()]
    public enum ExcelSaveFlags : System.Enum 
    Members
    MemberDescription
    AutoRowHeightThe default row height is not saved. Excel automatically determines row heights based on the largest font that is set in each row.
    DataOnlySaves only the data to the Excel-compatible file.
    NoFlagsSetSaves the spreadsheet to the Excel-compatible file with no special options.
    NoFormulasSaves the displayed data, but not the formulas, to the Excel-compatible file.
    SaveAsFilteredSaves the filtered row results to the Excel-compatible file.
    SaveAsViewedSaves the spreadsheet as viewed to the Excel-compatible file.
    SaveBothCustomRowAndColumnHeadersSaves both the custom row headers and the custom column headers to the Excel-compatible file.
    SaveCustomColumnHeadersSaves the custom column headers to the Excel-compatible file.
    SaveCustomRowHeadersSaves the custom row headers to the Excel-compatible file.
    Example
    This example uses the ExcelSaveFlags enumeration.
    private async void Button_Click_1(object sender, RoutedEventArgs e)
            {
                try
                {
                    var filePicker = new Windows.Storage.Pickers.FileSavePicker();
                    filePicker.FileTypeChoices.Add("Excel Files", new List<string>() { ".xls", ".xlsx" });
                    filePicker.SuggestedFileName = "New SpreadSheet File";
                    Windows.Storage.StorageFile storageFile = await filePicker.PickSaveFileAsync();
                    if (storageFile != null)
                    {
                        using (var stream = await storageFile.OpenStreamForWriteAsync())
                        {
                            var fileName = storageFile.FileType.ToUpperInvariant();
                            
                           await gcSpreadSheet1.SaveExcelAsync(stream, GrapeCity.Xaml.SpreadSheet.Data.ExcelFileFormat.XLSX);                       
                           //await gcSpreadSheet1.SaveExcelAsync(stream, GrapeCity.Xaml.SpreadSheet.Data.ExcelFileFormat.XLSX, GrapeCity.Xaml.SpreadSheet.Data.ExcelSaveFlags.DataOnly);                      
                        }
                    }
                }
                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.FileSavePicker()
                filePicker.FileTypeChoices.Add("Excel Files", New List(Of String)() From {".xls", ".xlsx"})
                filePicker.SuggestedFileName = "New SpreadSheet File"
                Dim storageFile As Windows.Storage.StorageFile = Await filePicker.PickSaveFileAsync()
    
                If storageFile IsNot Nothing Then
                    Using stream = Await storageFile.OpenStreamForWriteAsync()
                        Dim fileName = storageFile.FileType.ToUpperInvariant()
                        await GcSpreadSheet1.SaveExcelAsync(stream, GrapeCity.Xaml.SpreadSheet.Data.ExcelFileFormat.XLSX)                   
                        'await GcSpreadSheet1.SaveExcelAsync(stream, GrapeCity.Xaml.SpreadSheet.Data.ExcelFileFormat.XLSX, GrapeCity.Xaml.SpreadSheet.Data.ExcelSaveFlags.DataOnly)                    
                    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.ExcelSaveFlags

    See Also