예제 #1
0
        private void Export(string path)
        {
            List <ExcelEntity> excelEntities = new List <ExcelEntity>();
            ExcelEntity        excelEntity;

            foreach (DataGridViewRow row in dgv.Rows)
            {
                excelEntity = new ExcelEntity
                {
                    Name         = Convert.ToString(row.Cells[nameof(excelEntity.Name)].Value),
                    Email        = Convert.ToString(row.Cells[nameof(excelEntity.Email)].Value),
                    EmployeeCode = Convert.ToString(row.Cells[nameof(excelEntity.EmployeeCode)].Value),
                    Date         = (DateTime)row.Cells[nameof(excelEntity.Date)].Value,
                    TimeIn       = (DateTime)row.Cells[nameof(excelEntity.TimeIn)].Value,
                    TimeOut      = (DateTime)row.Cells[nameof(excelEntity.TimeOut)].Value,
                    Hours        = (decimal)row.Cells[nameof(excelEntity.Hours)].Value,
                    Remarks      = Convert.ToString(row.Cells[nameof(excelEntity.Remarks)].Value)
                };
                excelEntities.Add(excelEntity);
            }
            _excelService.Export(path, excelEntities);
            MessageBox.Show("Emails exported successfully");
            FetchActionControl(false);
            dgv.DataSource = null;
        }
예제 #2
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     if (SqliteUtil.Instance.IsExistData == false)
     {
         MessageBox.Show("没有数据将不予生成");
         return;
     }
     try
     {
         ExcelService = new ExcelService();
         ExcelService.Export(saveFileDialog);
         MessageBox.Show("生成Excel成功!");
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #3
0
 //
 public void ExportToExcel(TableView tableView, string excelFileName)
 {
     excelService.Export(tableView, excelFileName);
 }
예제 #4
0
 public BaseExcel(IExcelService excelService)
 {
     importExcelService = excelService.Import();
     exportExcelService = excelService.Export();
 }
예제 #5
0
 public BaseExcel(IExcelService excelService)
 {
     importExcelService = excelService.Import();
     exportExcelService = excelService.Export();
     readFileService    = excelService.ReadFile("");
 }