コード例 #1
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (job.CurrentIndex != job.Count)
            {
                Comment com = new Comment();
                com.ShowDialog();
                string       txt      = com.CommentText;
                XSSFWorkbook workbook = ExcelDataTableUtil.LoadExcel(job.JobPath);
                XSSFSheet    sheet    = (XSSFSheet)workbook.GetSheetAt(0);
                XSSFRow      row      = (XSSFRow)sheet.GetRow(job.CurrentIndex);
                row.Cells[dt.Columns.Count - 2].SetCellValue("U");

                XSSFColor     XlColour  = new XSSFColor(button5.BackColor);
                XSSFCellStyle cellstyle = (XSSFCellStyle)workbook.CreateCellStyle();
                cellstyle.SetFillForegroundColor(XlColour);
                cellstyle.FillPattern = NPOI.SS.UserModel.FillPattern.SolidForeground;
                row.Cells[dt.Columns.Count - 2].CellStyle = cellstyle;
                row.Cells[dt.Columns.Count - 1].SetCellValue(txt);
                ExcelDataTableUtil.WriteExcel(workbook, job.JobPath);
                job.CurrentIndex++;
                job.HasFinished++;
                Judge();
            }
            else
            {
                MessageBox.Show("已经是最后一条了");
            }
        }
コード例 #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (job.CurrentIndex != job.Count)
     {
         Comment com = new Comment();
         com.ShowDialog();
         string       txt      = com.CommentText;
         XSSFWorkbook workbook = ExcelDataTableUtil.LoadExcel(job.JobPath);
         XSSFSheet    sheet    = (XSSFSheet)workbook.GetSheetAt(0);
         XSSFRow      row      = (XSSFRow)sheet.GetRow(job.CurrentIndex);
         row.Cells[dt.Columns.Count - 2].SetCellValue("Y");
         row.Cells[dt.Columns.Count - 1].SetCellValue(txt);
         ExcelDataTableUtil.WriteExcel(workbook, job.JobPath);
         job.CurrentIndex++;
         job.HasFinished++;
         Judge();
     }
     else
     {
         MessageBox.Show("已经是最后一条了");
     }
 }