/** * 每个单元有6种类型的数据 1、doubel型 2、string 3、boolean 4、空格 5、错误 6、公式 * * @param cellIndex */ private void getCellData(short cellIndex) { ArrayList<String> target = new ArrayList<String>(); Transation temp = new Transation(mtitle[cellIndex]); switch (mcell.getCellType()) { case HSSFCell.CELL_TYPE_NUMERIC: // double型的数字 target.add(mformat.format(mcell.getNumericCellValue())); temp = new Transation(mtitle[cellIndex]); mperson.addData(temp.getFamily(), temp.getType(), target); break; case HSSFCell.CELL_TYPE_STRING: // 字符串 dealWithStrings(mcell.getStringCellValue(), target); if (cellIndex == mAddressPosition + DataManager.ADDRESSTYPE.length) mperson.mHasheadphoto = mcell.getStringCellValue(); else if (cellIndex == 0) mperson.addName(mcell.getStringCellValue()); else mperson.addData(temp.getFamily(), temp.getType(), target); break; case HSSFCell.CELL_TYPE_BOOLEAN: // 布尔值 mcell.getBooleanCellValue(); break; case HSSFCell.CELL_TYPE_BLANK: // 空格 Log.i("kongbai", "yes"); break; case HSSFCell.CELL_TYPE_ERROR: // 错误 break; case HSSFCell.CELL_TYPE_FORMULA: // 公式 break; default: break; } }
/** 获得头像 */ private void getHeadPhoto(int index) { if (index <= 0 || mList.size() <= 0 || mperson.mHasheadphoto.equals("no")) return; HSSFPictureData pdata = mList.get(mHeadphotoposition++); byte[] data = pdata.getData(); if (data.length != 0) { mperson.addHeadPhoto(BitmapFactory.decodeByteArray(data, 0, data.length)); } }