Esempio n. 1
0
        private void btnExcel_Click(object sender, EventArgs e)
        {
            if (dgvItems.Rows.Count > 0)
            {
                ExportToExcel exportToExcel = new ExportToExcel();
                exportToExcel.GenerateReport(m_items, m_billInfo);

                //Message box confirmation to view the created PDF document.
                if (MessageBox.Show("Do you want to view the Excel file?", "Excel File Created", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    //Launching the PDF file using the default Application.[Acrobat Reader]
#if !NETCORE
                    System.Diagnostics.Process.Start("Invoice.xlsx");
#else
                    ProcessStartInfo psi = new ProcessStartInfo
                    {
                        FileName        = "cmd",
                        WindowStyle     = ProcessWindowStyle.Hidden,
                        UseShellExecute = false,
                        CreateNoWindow  = true,
                        Arguments       = "/c start Invoice.xlsx"
                    };
                    Process.Start(psi);
#endif
                }
            }
            else
            {
                MessageBox.Show("No invoice items found to generate the report!", "Export Cancelled",
                                MessageBoxButtons.OK);
            }
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void ExcelExport_Click(object sender, RoutedEventArgs e)
        {
            MainGrid.IsHitTestVisible = false;
            MainGrid.Opacity          = 0.5;
            progress.Visibility       = Windows.UI.Xaml.Visibility.Visible;

            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, (() =>
            {
                ExportToExcel exportToExcel = new ExportToExcel();
                exportToExcel.GenerateReport(m_items, m_billInfo);
            }));

            MainGrid.IsHitTestVisible = true;
            MainGrid.Opacity          = 1;
            progress.Visibility       = Windows.UI.Xaml.Visibility.Collapsed;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ExcelExport_Click(object sender, RoutedEventArgs e)
        {
            MainGrid.IsHitTestVisible = false;
            MainGrid.Opacity          = 0.5;
            //progress.Visibility = Windows.UI.Xaml.Visibility.Visible;

            //await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, (() =>
            //{

            if (m_items.Count > 0)
            {
                ExportToExcel exportToExcel = new ExportToExcel();
                exportToExcel.GenerateReport(m_items, m_billInfo);
            }
            else
            {
                MessageBox.Show("No invoice items found to generate the report!", "Export Cancelled");
            }
            //}));

            MainGrid.IsHitTestVisible = true;
            MainGrid.Opacity          = 1;
            //progress.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
        }