/** InputStream inputstream= File.getinputstream () ;
*/@SuppressWarnings ("Deprecation") PublicBoolean falg (InputStream inputstream,string fileName)throwsioexception{Boolean falg=true; if(Filename.equals ("xlsx") {Xssfworkbook workbook=NewXssfworkbook (InputStream); Xssfsheet sheet= Workbook.getsheetat (0); if(sheet!=NULL) {Xssfrow row1= Sheet.getrow (0); if(row1!=NULL) {Xssfcell cell= Row1.getcell (( Short) 0); Xssfcell Cell1= Row1.getcell (( Short) 2); Xssfcell cell2= Row1.getcell (( Short) 3); if(cell==NULL||! Cell.tostring (). Equals ("information source")) {//Fieldfalg=false; returnFalg; } if(cell1==NULL||! Cell1.tostring (). Equals ("Proof of claim number") ) {Falg=false; returnFalg; } if(cell2==NULL||! Cell2.tostring (). Equals ("province") ) {Falg=false; returnFalg; } } } }Else{Hssfworkbook Workbook=NewHssfworkbook (InputStream); Hssfsheet sheet= Workbook.getsheetat (0); if(sheet!=NULL) {Hssfrow row1= Sheet.getrow (0); if(row1!=NULL) {Hssfcell cell= Row1.getcell (( Short) 0); Hssfcell Cell1= Row1.getcell (( Short) 2); Hssfcell cell2= Row1.getcell (( Short) 3); if(cell==NULL||! Cell.tostring (). Equals ("Information source") ) {Falg=false; returnFalg; } if(cell1==NULL||! Cell1.tostring (). Equals ("Proof of claim number") ) {Falg=false; returnFalg; } if(cell2==NULL||! Cell2.tostring (). Equals ("province") ) {Falg=false; returnFalg; } } } } returnFalg; }
Template for Java validation Import