Beispiel #1
0
        private void btnWord_Click(object sender, EventArgs e)
        {
            if (dgvItems.Rows.Count > 0)
            {
                ExportWord exportWord = new ExportWord();
                exportWord.CreateWord(m_items, m_billInfo, TotalDue);

                //Message box confirmation to view the created PDF document.
                if (MessageBox.Show("Do you want to view the Word file?", "Word Document Created", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                {
                    //Launching the PDF file using the default Application.[Acrobat Reader]
#if !NETCORE
                    System.Diagnostics.Process.Start("Invoice.docx");
#else
                    ProcessStartInfo psi = new ProcessStartInfo
                    {
                        FileName        = "cmd",
                        WindowStyle     = ProcessWindowStyle.Hidden,
                        UseShellExecute = false,
                        CreateNoWindow  = true,
                        Arguments       = "/c start Invoice.docx"
                    };
                    Process.Start(psi);
#endif
                }
            }
            else
            {
                MessageBox.Show("No invoice items found to generate the report!", "Export Cancelled",
                                MessageBoxButtons.OK);
            }
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void WordExport_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, (() =>
            {
                ExportWord exportWord = new ExportWord();
                exportWord.CreateWord(m_items, m_billInfo, TotalDue);
            }));

            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 WordExport_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)
            {
                ExportWord exportWord = new ExportWord();
                exportWord.CreateWord(m_items, m_billInfo, TotalDue);
            }
            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;
        }