private void Button1_Click(object sender, EventArgs e)
        {
            XLSX   excel          = new XLSX();
            string base_directory = AppDomain.CurrentDomain.BaseDirectory;
            string filePath       = ConfigReader.PersistableObject.Load <ConfigReader.Configuration>(String.Format("{0}\\config.xml", base_directory)).excel_path;

            excel.elaboraExcel(filePath);//"D:\\provaExcel.xlsx"
        }
        private void Button1_Click(object sender, EventArgs e)
        {
            Microsoft.Office.Interop.Word.Document documento = Globals.ThisAddIn.Application.ActiveDocument;
            messaggio = documento.Content.Text;

            /*XLSX excel = new XLSX();
             * string base_directory = AppDomain.CurrentDomain.BaseDirectory;
             * string filePath = ConfigReader.PersistableObject.Load<ConfigReader.Configuration>(String.Format("{0}\\config.xml", base_directory)).excel_path;
             * excel.elaboraExcel(filePath,messaggio);*/
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.CheckFileExists = true;
            openFileDialog.AddExtension    = true;
            openFileDialog.Multiselect     = false;
            openFileDialog.Filter          = "Excel Files|*.xls;*.xlsx";
            if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                XLSX xlsx = new XLSX();
                pnlControlloEmail.Hide();
                pnlRiepilogo.Hide();
                pnlCaricamento.BringToFront();
                pnlCaricamento.Show();
                listaMessaggi = xlsx.elaboraExcel(Path.GetFullPath(openFileDialog.FileName), messaggio);
            }
            Microsoft.Office.Interop.Outlook.Application olkApp1 = new Outlook.Application();
            Outlook.MailItem olkMail1 = (MailItem)olkApp1.CreateItem(OlItemType.olMailItem);
            Accounts         accounts = olkApp1.Application.Session.Accounts;

            cbIndirizzi.Items.Clear();
            foreach (Outlook.Account account in accounts)
            {
                cbIndirizzi.Items.Add(account.SmtpAddress.ToString());
            }
            cbIndirizzi.SelectedIndex = 0;
            List <messaggiErrati> listaMessaggiErrati = (from item in listaMessaggi where item.errore
                                                         select(new messaggiErrati()
            {
                MessaggioTest = item.MessaggioTest ? "SI" : "NO",
                Destinatario = item.Destinatario,
                Allegati = String.Concat(item.Allegati)
            })
                                                         ).ToList();

            dataGridView1.DataSource = listaMessaggiErrati;
            lblCheckMail.Text        = "Caricate " + listaMessaggi.Count + " righe";
            pnlCaricamento.Hide();
            pnlRiepilogo.Hide();
            pnlControlloEmail.BringToFront();
            pnlControlloEmail.Show();
        }
Beispiel #3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            XLSX excel = new XLSX();

            excel.elaboraExcel("D:\\provaExcel.xlsx");
        }