posts - 5,  comments - 7,  trackbacks - 0
          /**   
                  *   給料統(tǒng)計Excelファイル書く   
                  *   
          @param   fileName   folderName+fileName   
                  *   
          @param   value   List   
                  *   
          @throws   IOException   
                  
          */
             
                
          public   static   void   writeSalaryExcelFile(String   fileName,   List   value,   String   data,   String   deptName)   throws   
                IOException
          {   
                PayRecordForm   countResultForm   
          =   null;   
                InputStream   inputFile   
          =   null;   
                FileOutputStream   fOut   
          =   null;   
                HSSFWorkbook   wb   
          =   null;   
                
          try   {   
                
                            inputFile   
          =   new   FileInputStream(fileName);   
                            
          //workbook作成   
                            wb   =   new   HSSFWorkbook(inputFile);   
                              
                            
          //sheet作成   
                            HSSFSheet   sheet   =   wb.getSheetAt(0);   
                            
          //wb.setSheetName(0,   "DataCount");   
                            HSSFRow   row   =   null;   
                            HSSFCell   cell   
          =   null;   
                            
          //準(zhǔn)備完了   
                
                            SalaryPropertyRead   prop   
          =   new   SalaryPropertyRead();   
                            
          short   rowStart   =   OutBean.formatShort(prop.getProperty("start"));   
                            
          short   spanRow   =   OutBean.formatShort(prop.getProperty("rows"));   
                            String   str   
          =   "";   
                            String[]   postion   
          =   null;   
                              
                            HSSFRow   tempRow   
          =   null;   
                            
          //表數(shù)據(jù)   
                            int   size   =   value.size();   
                            
          int   currentRow   =   rowStart;   
                            
          for   (int   mIndex   =   0;   mIndex   <   size   ;   mIndex++)   {   
                            countResultForm   
          =   (PayRecordForm)value.get(mIndex);   
                            currentRow   
          =   rowStart+spanRow*mIndex;   
                            row   
          =   sheet.getRow(currentRow);       
                            
          if(row   ==   null){   
                            row   
          =   sheet.createRow(currentRow);   
                            }
             
                              
                            
          //名前   
                            setSalaryRow(sheet,row,prop.getProperty("employeeName"),currentRow,countResultForm.getEmployeeName());   
                            str   
          =   prop.getProperty("employeeName");   
                                                                      
                                    
          //日數(shù)     
                            setSalaryRow(sheet,row,prop.getProperty("workDays"),currentRow,countResultForm.getWorkDays());   
                                                      
                                    
          //出勤日數(shù)   
                            setSalaryRow(sheet,row,prop.getProperty("currentDays"),currentRow,countResultForm.getCurrentDays());   
                                                      
                                    
          //缺勤日數(shù)   
                            setSalaryRow(sheet,row,prop.getProperty("noWorkDays"),currentRow,countResultForm.getNoWorkDays());   
                                                      
                                    
          //遅刻回數(shù)   
                            setSalaryRow(sheet,row,prop.getProperty("lateDays"),currentRow,countResultForm.getLateDays());   
                                                      
                                    
          //早退回數(shù)   
                            setSalaryRow(sheet,row,prop.getProperty("exitEarlyDays"),currentRow,countResultForm.getExitEarlyDays());   
                                              
                                    
          //殘業(yè)週末時間           
                            setSalaryRow(sheet,row,prop.getProperty("weekDays"),currentRow,countResultForm.getWeekDays());   
                                                      
                                    
          //有給休暇日數(shù)         
                            setSalaryRow(sheet,row,prop.getProperty("payAppDays"),currentRow,countResultForm.getPayAppDays());   
                                                    
                                    
          //まきの休暇を取る日數(shù)がない       
                            setSalaryRow(sheet,row,prop.getProperty("noPayAppDays"),currentRow,countResultForm.getNoPayAppDays());   
                                                              
                                    
          //基本給料       
                            setSalaryRow(sheet,row,prop.getProperty("base"),currentRow,countResultForm.getBase());   
                                                            
                                    
          //全勤給料     
                            setSalaryRow(sheet,row,prop.getProperty("allPay"),currentRow,countResultForm.getAllPay());   
                                                              
                                    
          //保険金額                           
                                    setSalaryRow(sheet,row,prop.getProperty("insurance"),currentRow,countResultForm.getInsurance());   
                              
                            }
                         
                            
          //入力完了   
              
                            
          //新規(guī)出力文件流   
                            fOut   =   new   FileOutputStream(fileName);   
                            
          //   保存する。   
                            wb.write(fOut);   
                            fOut.flush();   
                            
          //作成完了、ファイルを閉じる。                 
                            System.out.println("ファイル作成完了!");   
              
                        }
             
                        
          catch   (Exception   e)   {   
                        e.printStackTrace();   
                            System.out.println(
          "   xlCreate()   :   "   +   e);   
                        }
             finally   {   
                        
          try{   
                        wb   
          =   null;   
                        
          if(fOut   !=   null){   
                        fOut.close();   
                        }
             
                        
          if(inputFile   !=   null){   
                        inputFile.close();   
                        }
             
                        }
             catch   (Exception   e){               
                        }
             
                        }
             
                }
             
          posted on 2008-11-29 10:04 Vincent-chen 閱讀(411) 評論(0)  編輯  收藏 所屬分類: POI
          主站蜘蛛池模板: 武冈市| 南和县| 胶南市| 娄烦县| 西乡县| 唐海县| 南和县| 宁化县| 潮安县| 大厂| 西林县| 扎兰屯市| 安远县| 青州市| 新乡市| 余江县| 洪洞县| 伊宁市| 滦南县| 崇州市| 桐柏县| 吉木乃县| 玛沁县| 长垣县| 柏乡县| 双桥区| 宝应县| 班戈县| 通州市| 团风县| 长海县| 合川市| 丹凤县| 蛟河市| 济源市| 四会市| 高雄市| 馆陶县| 宁蒗| 军事| 体育|