예제 #1
0
 private void Add(CollectExcel collect)
 {
     lock (_syncRoot)
     {
         _result.Add(collect);
     }
 }
예제 #2
0
        private CollectExcel Program(StockFile stockfile, List <ExcelField> fields)
        {
            IWorkbook workbook = stockfile.FullName.OpenExcel();

            if (workbook != null)
            {
                ISheet sheet = workbook.GetSheetAt(0);
                if (sheet != null)
                {
                    int   count = 0;
                    IRow  row   = null;
                    ICell cell  = null;
                    for (var i = CollectTable.StartIndex; i <= sheet.LastRowNum; i++)
                    {
                        row = sheet.GetRow(i);
                        if (row == null)
                        {
                            break;
                        }
                        cell = row.GetCell(0);
                        if (cell.ToString().ToLower() == "合计".ToLower())
                        {
                            var result  = Analyze(row, fields);
                            var collect = new CollectExcel
                            {
                                XZQDM  = stockfile.XZQDM,
                                XZQMC  = stockfile.XZQMC,
                                Count  = count,
                                Values = result
                            };
                            return(collect);
                        }
                        else if (Regex.IsMatch(cell.ToString(), "^33[0-9]{7}$"))
                        {
                            count++;
                        }
                    }
                }
            }
            return(null);
        }