Ejemplo n.º 1
0
        public void ExportToExcel(string SaveFileName)
        {
            Excel mexportExcel = new Excel(SaveFileName, false);

            string datetime = DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Day.ToString() + "  " +
                              DateTime.Now.Hour.ToString() + "'" + DateTime.Now.Minute.ToString() + "'" + DateTime.Now.Second.ToString();
            string sheetname = "计算转正天数" + datetime;

            mexportExcel.AddWorksheet(sheetname);
            mexportExcel.SetCurrentWorksheet(sheetname);
            for (int i = 0; i < AssessSourcecollection.Count; i++)
            {
                if (AssessSourcecollection[i].TimePercent == "无")
                {
                    continue;
                }
                mexportExcel.SetCell(i + 1, 1, AssessSourcecollection[i].OrderNumber.ToString());
                mexportExcel.SetCell(i + 1, 2, AssessSourcecollection[i].StaffName);
                mexportExcel.SetCell(i + 1, 3, AssessSourcecollection[i].StaffDep);
                mexportExcel.SetCell(i + 1, 4, AssessSourcecollection[i].StaffPostion);
                mexportExcel.SetSelFormatText(i + 1, 5);
                mexportExcel.SetCell(i + 1, 5, AssessSourcecollection[i].TimePercent);
                mexportExcel.SetCell(i + 1, 6, AssessSourcecollection[i].mNewStaffSalary.ProbationSalary);
                mexportExcel.SetCell(i + 1, 7, AssessSourcecollection[i].mNewStaffSalary.FullSalary);
                mexportExcel.SetCell(i + 1, 8, AssessSourcecollection[i].mNewStaffSalary.balance);
                mexportExcel.SetCell(i + 1, 9, AssessSourcecollection[i].CompanyInfo);
            }
            for (int i = 1; i < 10; i++)
            {
                mexportExcel.ColumnAutoFit(1, i);
            }
            mexportExcel.SaveAs2003(SaveFileName);
            mexportExcel.Save();
            mexportExcel.Visible = true;
        }
Ejemplo n.º 2
0
        public void DoWorkCalThread(Action <int> percent)
        {
            mExcel = new Excel(SalaryFile, false);
            mExcel.SetCurrentWorksheet(SalaryDate);
            percent(10);
            float proc = (float)0.0000;

            for (int i = 2; i <= mExcel.RowCount; i++)
            {
                NewStaffSalary mAssessSource = new NewStaffSalary();

                mAssessSource.StaffName       = mExcel.GetCell(i, 2);
                mAssessSource.ProbationSalary = mExcel.GetCell(i, 8);
                mAssessSource.FullSalary      = mExcel.GetCell(i, 9);
                NewStaffSalaryList.Add(mAssessSource);
                proc = (float)i / (float)mExcel.RowCount * (float)100;
                percent((int)proc);
            }


            int ProcessPos = 0;

            AssessSourcecollection.Clear();
            mExcel = new Excel(ExportFile, false);
            mExcel.SetCurrentWorksheet(Date);
            percent(10);
            for (int i = 2; i <= mExcel.RowCount; i++)
            {
                AssessSource mAssessSource = new AssessSource();
                mAssessSource.OrderNumber  = i - 1;
                mAssessSource.StaffName    = mExcel.GetCell(i, 1);
                mAssessSource.StaffDep     = mExcel.GetCell(i, 2);
                mAssessSource.StaffPostion = mExcel.GetCell(i, 3);
                mAssessSource.EntryTime    = mExcel.GetCell(i, 4);
                mAssessSource.EndTime      = mExcel.GetCell(i, 5);
                mAssessSource.PositiveTime = mExcel.GetCell(i, 6);
                mAssessSource.CompanyInfo  = mExcel.GetCell(i, 10);

                FillmAssessSourceSalary(ref mAssessSource);

                string tempre = mAssessSource.GetTimePercent(DateXiuxiRi, Date);
                if (tempre != "")
                {
                    mExcel.SetCellComment(i, 6, tempre);
                }

                AssessSourcecollection.Add(mAssessSource);
            }
            percent(70);
            SortByCompanyAndPercent();
            string tempzhuanzheng = "";

            mExcel.Save();
            mExcel.Visible = true;
            tempzhuanzheng = mIniFile.IniReadValue("AssessFile", "转正导出文件", tempzhuanzheng);



            ExportToExcel(AppDomain.CurrentDomain.BaseDirectory + tempzhuanzheng);
            percent(100);


            mExcel.Clean();
            mExcel.Dispose();
        }