java poi 处理excel数据(不连续)

public static void main(String[] args) {
	//	ExcelParam ec=new ExcelParam("src/test/resources/register.xlsx",2,7,1,4);
		int rows[]={1,2,3,4,5,6,7};
		int cells[]={1,2,3,4};
	    Object datas[][]=ExcelUtil.reads("src/test/resources/register.xlsx",rows,cells);
		for(Object[] rowData:datas){
			for(Object cellData:rowData){
				System.out.print("["+cellData+"]");
			}
			System.out.println();
		}
			
	}
	/**
	 *  处理不连续的excel数据,同一个sheet里面
	 * @param filePath 
	 * @param rows 数组
	 * @param cells 数组
	 * @return
	 */
	public static Object[][] reads(String filePath,int rows[],int cells[]){
		
		Object datas[][]=new Object[rows.length][cells.length];
		try {
		  Workbook	workbook=WorkbookFactory.create(new File(filePath));
		  Sheet sheet=workbook.getSheetAt(0);
			for(int i=0;i

 

你可能感兴趣的:(selenium,Java,poi)