private void btnExportExcel_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();

            folderBrowserDialog.RootFolder          = Environment.SpecialFolder.Desktop;
            folderBrowserDialog.ShowNewFolderButton = false;

            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                ExportExcel obj = new ExportExcel();
                if (cbbThongKe.Text.ToString() == "Doanh Thu")
                {
                    obj.WriteDataTableToExcel(dataExportExcel, "Doanh Thu", folderBrowserDialog.SelectedPath + "\\" + "thongKeDoanhThu.xlsx", "");
                }
                else
                {
                    obj.WriteDataTableToExcel(dataExportExcel, "Sản Phẩm Đã Bán", folderBrowserDialog.SelectedPath + "\\" + "thongKeSPDaBan.xlsx", "");
                }


                MessageBox.Show("Xuất file thống kê thành công!", "Thông Báo");
            }
        }
Example #2
0
        private void guna2ImageButton1_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();

            folderBrowserDialog.RootFolder          = Environment.SpecialFolder.Desktop;
            folderBrowserDialog.ShowNewFolderButton = false;

            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                ExportExcel obj = new ExportExcel();
                obj.WriteDataTableToExcel(data, "Nhân Viên", folderBrowserDialog.SelectedPath + "\\" + "nhanVien.xlsx", "");


                MessageBox.Show("Xuất file nhân viên thành công!", "Thông Báo");
            }
        }
        private void btnExportExcel_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();

            folderBrowserDialog.RootFolder          = Environment.SpecialFolder.Desktop;
            folderBrowserDialog.ShowNewFolderButton = false;

            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                ExportExcel obj = new ExportExcel();
                obj.WriteDataTableToExcel(dataExcel, "Danh mục", folderBrowserDialog.SelectedPath + "\\" + "danhMuc.xlsx", "");


                MessageBox.Show("Xuất file danh mục thành công!", "Thông Báo");
            }
        }