Example #1
0
        /// <summary>
        /// Called when [execute export all to excel].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs"/> instance containing the event data.</param>
        private static void OnExecuteExportAllToExcel(object sender, ExecutedRoutedEventArgs args)
        {
            GridDataControl grid = args.Source as GridDataControl;

            try
            {
                grid.ExportToExcel("Sample.xls", ExcelVersion.Excel97to2003);
                System.Diagnostics.Process.Start("Sample.xls");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
        }
Example #2
0
        /// <summary>
        /// Called when [execute export selected to excel].
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs"/> instance containing the event data.</param>
        private static void OnExecuteExportSelectedToExcel(object sender, ExecutedRoutedEventArgs args)
        {
            GridDataControl grid = args.Source as GridDataControl;

            if (grid != null && !grid.Model.SelectedRanges.ActiveRange.IsEmpty)
            {
                try
                {
                    grid.ExportToExcel(grid.Model.SelectedRanges.ActiveRange, "Sample.xls", ExcelVersion.Excel97to2003);
                    System.Diagnostics.Process.Start("Sample.xls");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
            }
        }