- 浏览: 17754 次
- 性别:
- 来自: 广州
最新评论
用poi解析有合并单元格的excel
ProjectExplainExcelUtil.java
ProjectExplain.java
ProjectExplainEnum.java
ProjectExplainExcelUtil.java
package com.concom.imports.project.util; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; import java.util.regex.Pattern; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; import org.apache.poi.ss.util.CellRangeAddress; import org.json.JSONObject; import com.concom.imports.project.dto.ProjectExplain; import com.concom.imports.project.enums.ProjectExplainEnum; import com.concom.imports.utils.ReadExcelUtils; import com.concom.lang.helper.StringHelper; /** * 编制说明excel解析帮助类 * @author Cao Zhili * @date 2015年4月23日 */ public class ProjectExplainExcelUtil { private static Pattern pattern = Pattern.compile("\\s*|\t|\r|\n"); private static final String CHECK_SHEETNAME = "编制说明"; private static final String CHECK_BEGINNAME = "工程概况"; private static final String PROJECT_BID = "F-3"; private static final String CHECK_SHEETNAME_CONSTRUCT = "建筑装饰工程概况"; private static final String PROJECT_AMOUNT = "投标总价(小写)"; private static final String PROJECT_AMOUNT2 = "招标控制价"; private static final String PREPARATION_TIME = "编制时间"; private static final String YUAN = "元"; private static final String YEAR = "年"; public static void main(String[] args) { try { //String file = "G:\\DATA\\广州市站工程案例\\土建\\0895\\附件3:《广州市房屋建筑和市政基础设施工程施工招标控制价编制参考范本(2010年)》.xls"; String file = "G:\\DATA\\云造价产品\\GZ-2014-0251大岗绿庭雅苑酒店工程\\预算书\\0.封面.xls"; ProjectExplain projectExplain = readExcel(file); System.out.println(new JSONObject(projectExplain)); System.out.println("编制时间: "+projectExplain.getPreparationtime()); System.out.println("总金额: "+projectExplain.getProjectamount()); System.out.println("areaUnit: "+projectExplain.getAreaUnit()); } catch (Exception e) { e.printStackTrace(); } } public static ProjectExplain readExcel(String filePath) throws IOException{ FileInputStream excelFileStream = null; try { excelFileStream = new FileInputStream(filePath); return readExcel(excelFileStream); } catch (Exception e) { e.printStackTrace(); }finally{ excelFileStream.close(); excelFileStream=null; } return null; } public static ProjectExplain readExcel(File file) throws IOException{ FileInputStream excelFileStream = null; try { excelFileStream = new FileInputStream(file); return readExcel(excelFileStream); } catch (Exception e) { e.printStackTrace(); }finally{ excelFileStream.close(); excelFileStream=null; } return null; } public static ProjectExplain readExcel(InputStream inputStream) throws Exception { ProjectExplain projectExplain = new ProjectExplain(); Sheet sheet = null; Workbook workbook = null; /*if (version == 2003) {// 2003 POIFSFileSystem fs = new POIFSFileSystem(inputStream); workbook = new HSSFWorkbook(fs); } else if (version == 2007) {// 2007 workbook = new XSSFWorkbook(inputStream); } */ workbook = WorkbookFactory.create(inputStream); //POIFSFileSystem excel = new POIFSFileSystem(inputStream); //HSSFWorkbook workbook = new HSSFWorkbook(excel); int sheets = workbook.getNumberOfSheets(); //HSSFSheet sheet = null; int beginRow = 0; int beginCell = 0; for (int i = 0; i < sheets; i++) { sheet = workbook.getSheetAt(i); int lastRowNum = sheet.getLastRowNum(); if(PROJECT_BID.equals(sheet.getSheetName()) || i==0){ //获取项目总金额和编制时间 List<CellRangeAddress> listCombineCell = getCombineCell(sheet); boolean exist = false; for (int j = 0; j <= lastRowNum; j++) { Row row = sheet.getRow(j); if (null == row) { continue; } for (Cell c : row) { if (null == c) { continue; } String cellValue = ReadExcelUtils.getCellValue(c); if (cellValue.startsWith(PROJECT_AMOUNT) || cellValue.startsWith(PROJECT_AMOUNT2)) { Double projectAmount = getNumberValue(listCombineCell, sheet, row, c.getColumnIndex()); projectExplain.setProjectamount(projectAmount); break; } if (cellValue.startsWith(PREPARATION_TIME)) { String preparationTime = getPreparationtimeValue(listCombineCell, sheet, row, c.getColumnIndex()); projectExplain.setPreparationtime(preparationTime); exist = true; break; } } if(exist){ break; } } } if (!sheet.getSheetName().contains(CHECK_SHEETNAME)) { continue; } // 获取工程概况列和行 for (int j = 0; j <= lastRowNum; j++) { Row row = sheet.getRow(j); if (null == row) { continue; } for (Cell c : row) { if (null == c) { continue; } if (CHECK_BEGINNAME.equals(ReadExcelUtils.getCellValue(c))) { beginRow = c.getRowIndex(); beginCell = c.getColumnIndex(); break; } } if (beginRow > 0) { break; } } setProjectValue(projectExplain,sheet,beginRow,beginCell); } sheet = workbook.getSheet(CHECK_SHEETNAME_CONSTRUCT); if(null!=sheet){ setProjectValue(projectExplain,sheet,0,beginCell); } return projectExplain; } public static ProjectExplain readExcel(int version,InputStream inputStream) throws Exception { ProjectExplain projectExplain = new ProjectExplain(); Sheet sheet = null; Workbook workbook = null; /*if (version == 2003) {// 2003 POIFSFileSystem fs = new POIFSFileSystem(inputStream); workbook = new HSSFWorkbook(fs); } else if (version == 2007) {// 2007 workbook = new XSSFWorkbook(inputStream); } */ workbook = WorkbookFactory.create(inputStream); //POIFSFileSystem excel = new POIFSFileSystem(inputStream); //HSSFWorkbook workbook = new HSSFWorkbook(excel); int sheets = workbook.getNumberOfSheets(); //HSSFSheet sheet = null; int beginRow = 0; int beginCell = 0; for (int i = 0; i < sheets; i++) { sheet = workbook.getSheetAt(i); int lastRowNum = sheet.getLastRowNum(); if(PROJECT_BID.equals(sheet.getSheetName())){ //获取项目总金额和编制时间 List<CellRangeAddress> listCombineCell = getCombineCell(sheet); boolean exist = false; for (int j = 0; j <= lastRowNum; j++) { Row row = sheet.getRow(j); if (null == row) { continue; } for (Cell c : row) { if (null == c) { continue; } if (PROJECT_AMOUNT.equals(ReadExcelUtils.getCellValue(c))) { Double projectAmount = getNumberValue(listCombineCell, sheet, row, c.getColumnIndex()); projectExplain.setProjectamount(projectAmount); break; } if (PREPARATION_TIME.equals(ReadExcelUtils.getCellValue(c))) { String preparationTime = getPreparationtimeValue(listCombineCell, sheet, row, c.getColumnIndex()); projectExplain.setPreparationtime(preparationTime); exist = true; break; } } if(exist){ break; } } } if (!sheet.getSheetName().contains(CHECK_SHEETNAME)) { continue; } // 获取工程概况列和行 for (int j = 0; j <= lastRowNum; j++) { Row row = sheet.getRow(j); if (null == row) { continue; } for (Cell c : row) { if (null == c) { continue; } if (CHECK_BEGINNAME.equals(ReadExcelUtils.getCellValue(c))) { beginRow = c.getRowIndex(); beginCell = c.getColumnIndex(); break; } } if (beginRow > 0) { break; } } List<CellRangeAddress> listCombineCell = getCombineCell(sheet); String tempVal = null; String mergeName = null; for (int j = beginRow; j <= lastRowNum; j++) { Row row = sheet.getRow(j); if (null == row) { continue; } String tempName = null; Cell cName = row.getCell(beginCell); if (null == cName) { continue; } tempName = ReadExcelUtils.getCellValue(cName); if (null == tempName) { continue; } Cell cValue = row.getCell(beginCell+1); boolean isMerge = isCombineCell(listCombineCell, cName, sheet); if(isMerge){ tempName = getMergedRegionValue(sheet, row.getRowNum(), cName.getColumnIndex()); String tVal = ReadExcelUtils.getCellValue(cValue).trim(); //System.out.println(tempName+"-->"+tVal); if(null!=tVal && !"".equals(tVal)){ if(null!=mergeName && mergeName.equals(tempName)){ tempVal += ","+tVal; }else{ tempVal = tVal; } } mergeName = tempName; }else{ mergeName = null; tempVal = ReadExcelUtils.getCellValue(cValue).trim(); } for(ProjectExplainEnum tempEnum : ProjectExplainEnum.values()){ if(tempName.startsWith(tempEnum.getName())){ String methodName = getMethodName(tempEnum.name()); if("String".equals(tempEnum.getType())){ if(null!=tempVal){ projectExplain.getClass().getMethod(methodName,String.class).invoke(projectExplain, tempVal); }else{ projectExplain.getClass().getMethod(methodName,String.class).invoke(projectExplain, ""); } }else if("Double".equals(tempEnum.getType())){ if(null!=tempVal && !"".equals(tempVal)){ if(tempVal.contains("%")){ tempVal = tempVal.replaceAll("%", ""); } projectExplain.getClass().getMethod(methodName,Double.class).invoke(projectExplain, Double.parseDouble(tempVal)); }else{ projectExplain.getClass().getMethod(methodName,Double.class).invoke(projectExplain, 0d); } } } } } } return projectExplain; } private static void setProjectValue(ProjectExplain projectExplain,Sheet sheet,int beginRow,int beginCell) throws Exception{ int lastRowNum = sheet.getLastRowNum(); List<CellRangeAddress> listCombineCell = getCombineCell(sheet); String tempVal = null; String mergeName = null; for (int j = beginRow; j <= lastRowNum; j++) { Row row = sheet.getRow(j); if (null == row) { continue; } String tempName = null; Cell cName = row.getCell(beginCell); if (null == cName) { continue; } tempName = ReadExcelUtils.getCellValue(cName); if (null == tempName) { continue; } Cell cValue = row.getCell(beginCell+1); boolean isMerge = isCombineCell(listCombineCell, cName, sheet); if(isMerge){ tempName = getMergedRegionValue(sheet, row.getRowNum(), cName.getColumnIndex()); String tVal = ReadExcelUtils.getCellValue(cValue).trim(); //System.out.println(tempName+"-->"+tVal); if(null!=tVal && !"".equals(tVal)){ if(null!=mergeName && mergeName.equals(tempName)){ tempVal += ","+tVal; }else{ tempVal = tVal; } } mergeName = tempName; }else{ mergeName = null; tempVal = ReadExcelUtils.getCellValue(cValue).trim(); } //System.out.println("tempName: "+tempName); for(ProjectExplainEnum tempEnum : ProjectExplainEnum.values()){ if(tempName.startsWith(tempEnum.getName())){ if(tempName.startsWith(ProjectExplainEnum.constructionArea.getName())){ //获取面积单位 String areaUnit = ReadExcelUtils.getCellValue(row.getCell(beginCell+2)); if(null!=areaUnit && !"".equals(areaUnit)){ projectExplain.setAreaUnit(areaUnit); } } String methodName = getMethodName(tempEnum.name()); if("String".equals(tempEnum.getType())){ if(null!=tempVal){ projectExplain.getClass().getMethod(methodName,String.class).invoke(projectExplain, tempVal); }else{ projectExplain.getClass().getMethod(methodName,String.class).invoke(projectExplain, ""); } }else if("Double".equals(tempEnum.getType())){ if(null!=tempVal && !"".equals(tempVal)){ if(tempVal.contains("%")){ tempVal = tempVal.replaceAll("%", ""); } if(!StringHelper.isNumber(tempVal, true)){ tempVal="0"; } projectExplain.getClass().getMethod(methodName,Double.class).invoke(projectExplain, Double.parseDouble(tempVal)); }else{ projectExplain.getClass().getMethod(methodName,Double.class).invoke(projectExplain, 0d); } }else if("Integer".equals(tempEnum.getType())){ if(null!=tempVal && !"".equals(tempVal)){ projectExplain.getClass().getMethod(methodName,Integer.class).invoke(projectExplain, Integer.parseInt(tempVal)); }else{ projectExplain.getClass().getMethod(methodName,Integer.class).invoke(projectExplain, 0d); } } } } } } /** * 获取项目总金额 * @param listCombineCell * @param sheet * @param row * @param beginIndex * @return * @throws Exception */ private static Double getNumberValue(List<CellRangeAddress> listCombineCell,Sheet sheet,Row row,int beginIndex) throws Exception { Double value = 0d; if (null == row) { return value; } for(int i=beginIndex;i<row.getLastCellNum();i++){ Cell c = row.getCell(i); if (null == c) { continue; } String tempVal = ReadExcelUtils.getCellValue(c); tempVal = tempVal.replaceAll(YUAN, ""); if(isNumeric(tempVal)){ value = Double.parseDouble(tempVal); break; } } return value; } /** * 获取编制时间 * @param listCombineCell * @param sheet * @param row * @param beginIndex * @return * @throws Exception */ private static String getPreparationtimeValue(List<CellRangeAddress> listCombineCell,Sheet sheet,Row row,int beginIndex) throws Exception { String value = ""; if (null == row) { return value; } for(int i=beginIndex;i<row.getLastCellNum();i++){ Cell c = row.getCell(i); if (null == c) { continue; } String tempVal = ReadExcelUtils.getCellValue(c); if(Cell.CELL_TYPE_NUMERIC==c.getCellType()){ tempVal = dayAddition((int)Double.parseDouble(tempVal)); } //System.out.println("tempVal: "+tempVal); if(null!=tempVal && tempVal.contains(YEAR)){ value = tempVal; break; } } return value; } //日期相加天数 public static String dayAddition(int num) throws Exception{ SimpleDateFormat timeformat = new SimpleDateFormat("yyyy年MM月dd日"); java.util.Date date = timeformat.parse("1900年01月01日"); Calendar a = Calendar.getInstance(); a.setTime(date); a.add(Calendar.DATE, (num-2)); return timeformat.format(a.getTime()); } /** * 合并单元格处理,获取合并行 * * @param sheet * @return List<CellRangeAddress> */ private static List<CellRangeAddress> getCombineCell(Sheet sheet) { List<CellRangeAddress> list = new ArrayList<CellRangeAddress>(); // 获得一个 sheet 中合并单元格的数量 int sheetmergerCount = sheet.getNumMergedRegions(); // 遍历合并单元格 for (int i = 0; i < sheetmergerCount; i++) { // 获得合并单元格加入list中 CellRangeAddress ca = sheet.getMergedRegion(i); list.add(ca); } return list; } /** * 判断单元格是否为合并单元格,是的话则将单元格的值返回 * * @param listCombineCell * 存放合并单元格的list * @param cell * 需要判断的单元格 * @param sheet * sheet * @return */ private static boolean isCombineCell(List<CellRangeAddress> listCombineCell, Cell cell, Sheet sheet) throws Exception { int firstC = 0; int lastC = 0; int firstR = 0; int lastR = 0; for (CellRangeAddress ca : listCombineCell) { // 获得合并单元格的起始行, 结束行, 起始列, 结束列 firstC = ca.getFirstColumn(); lastC = ca.getLastColumn(); firstR = ca.getFirstRow(); lastR = ca.getLastRow(); if (cell.getRowIndex() >= firstR && cell.getRowIndex() <= lastR) { if (cell.getColumnIndex() >= firstC && cell.getColumnIndex() <= lastC) { return true; } } } return false; } private static Cell getNextCell(List<CellRangeAddress> listCombineCell, Cell cell, Sheet sheet) throws Exception{ if(isCombineCell(listCombineCell, cell, sheet)){ int mergeCol = getMergeCol(listCombineCell, cell, sheet); cell = sheet.getRow(cell.getRowIndex()).getCell(cell.getColumnIndex()+mergeCol+1); return cell; }else{ return cell; } } private static int getMergeCol(List<CellRangeAddress> listCombineCell, Cell cell, Sheet sheet) throws Exception { int firstC = 0; int lastC = 0; int firstR = 0; int lastR = 0; for (CellRangeAddress ca : listCombineCell) { // 获得合并单元格的起始行, 结束行, 起始列, 结束列 firstC = ca.getFirstColumn(); lastC = ca.getLastColumn(); firstR = ca.getFirstRow(); lastR = ca.getLastRow(); if (cell.getRowIndex() >= firstR && cell.getRowIndex() <= lastR) { if (cell.getColumnIndex() >= firstC && cell.getColumnIndex() <= lastC) { return lastC-firstC; } } } return 0; } /** * 获取合并单元格的值 * * @param sheet * @param row * @param column * @return */ private static String getMergedRegionValue(Sheet sheet, int row, int column) { int sheetMergeCount = sheet.getNumMergedRegions(); for (int i = 0; i < sheetMergeCount; i++) { CellRangeAddress ca = sheet.getMergedRegion(i); int firstColumn = ca.getFirstColumn(); int lastColumn = ca.getLastColumn(); int firstRow = ca.getFirstRow(); int lastRow = ca.getLastRow(); if (row >= firstRow && row <= lastRow) { if (column >= firstColumn && column <= lastColumn) { Row fRow = sheet.getRow(firstRow); Cell fCell = fRow.getCell(firstColumn); return ReadExcelUtils.getCellValue(fCell); } } } return null; } /** * 获取属性get方法 * @param fieldName * @return */ public static String getMethodName(String fieldName){ String firstChar = fieldName.charAt(0)+""; return "set"+firstChar.toUpperCase()+fieldName.substring(1); } /** * 判断是否数值 * * @param str * @return */ public static boolean isNumeric(String str) { Pattern pattern = Pattern.compile("[-]?[0-9]+[.]?[0-9]*"); return pattern.matcher(str).matches(); } }
ProjectExplain.java
package com.concom.imports.project.dto; /** * 编制说明 * * @author Cao Zhili * @date 2015年4月23日 */ public class ProjectExplain { private String projectname;// 工程名称 private String projectaddr;// 工程地点 private Double projectamount;// 项目总金额 private String otherinfo; private String compilationbasis;// 编制依据 private String construnit;// 建设单位 private String costcheckunit;// 编审单位 private String blueprint;// 图纸 private String designdate;// 设计日期 private String designation;// 图纸名称 private String pricingstandard;// 计价规范 private String valuationbasis;// 计价依据 private String pricesdate;// 材料价格取定时间 private String projectphase;// 项目阶段 private String costtype;// 造价类别 private String preparationtime;// 编制时间 private String flieno;// 文号 private String valuationtype;// 计价方式 private String designunit;// 设计单位 private String categoryName;// 项目大类型 private String subcategoryName;// 项目类型 private String projectphaseName;// 项目阶段 // 2015-7-14新增 private String proUse;// 项目用途 private String storeyHeight;// 层高(m) private Double storeyNum;// 层数 private Double eavesHeight;// 檐高(m) private String startWorkDate;// 开工日期 private String endWorkDate;// 竣工日期 private String structureType;// 结构类型 private String seismicIntensity;// 杭震烈度 private String decorateStandard;// 装修标准 private Double constructionArea;// 建筑面积 private Double undergroundArea;// 地下建筑面积 private Double overgroundArea;// 地上建筑面积 private String areaUnit;//建筑面积单位 private String overgroundStoreyNum;//地上层数 private String undergroundStoreyNum;//地下层数 public String getUndergroundStoreyNum() { return undergroundStoreyNum; } public void setUndergroundStoreyNum(String undergroundStoreyNum) { this.undergroundStoreyNum = undergroundStoreyNum; } public String getOvergroundStoreyNum() { return overgroundStoreyNum; } public void setOvergroundStoreyNum(String overgroundStoreyNum) { this.overgroundStoreyNum = overgroundStoreyNum; } public String getProjectname() { return projectname; } public void setProjectname(String projectname) { this.projectname = projectname; } public String getProjectaddr() { return projectaddr; } public void setProjectaddr(String projectaddr) { this.projectaddr = projectaddr; } public Double getProjectamount() { return projectamount; } public void setProjectamount(Double projectamount) { this.projectamount = projectamount; } public String getOtherinfo() { return otherinfo; } public void setOtherinfo(String otherinfo) { this.otherinfo = otherinfo; } public String getCompilationbasis() { return compilationbasis; } public void setCompilationbasis(String compilationbasis) { this.compilationbasis = compilationbasis; } public String getConstrunit() { return construnit; } public void setConstrunit(String construnit) { this.construnit = construnit; } public String getCostcheckunit() { return costcheckunit; } public void setCostcheckunit(String costcheckunit) { this.costcheckunit = costcheckunit; } public String getBlueprint() { return blueprint; } public void setBlueprint(String blueprint) { this.blueprint = blueprint; } public String getDesigndate() { return designdate; } public void setDesigndate(String designdate) { this.designdate = designdate; } public String getDesignation() { return designation; } public void setDesignation(String designation) { this.designation = designation; } public String getPricingstandard() { return pricingstandard; } public void setPricingstandard(String pricingstandard) { this.pricingstandard = pricingstandard; } public String getValuationbasis() { return valuationbasis; } public void setValuationbasis(String valuationbasis) { this.valuationbasis = valuationbasis; } public String getPricesdate() { return pricesdate; } public void setPricesdate(String pricesdate) { this.pricesdate = pricesdate; } public String getProjectphase() { return projectphase; } public void setProjectphase(String projectphase) { this.projectphase = projectphase; } public String getCosttype() { return costtype; } public void setCosttype(String costtype) { this.costtype = costtype; } public String getPreparationtime() { return preparationtime; } public void setPreparationtime(String preparationtime) { this.preparationtime = preparationtime; } public String getFlieno() { return flieno; } public void setFlieno(String flieno) { this.flieno = flieno; } public String getValuationtype() { return valuationtype; } public void setValuationtype(String valuationtype) { this.valuationtype = valuationtype; } public String getDesignunit() { return designunit; } public void setDesignunit(String designunit) { this.designunit = designunit; } public String getCategoryName() { return categoryName; } public void setCategoryName(String categoryName) { this.categoryName = categoryName; } public String getSubcategoryName() { return subcategoryName; } public void setSubcategoryName(String subcategoryName) { this.subcategoryName = subcategoryName; } public String getProjectphaseName() { return projectphaseName; } public void setProjectphaseName(String projectphaseName) { this.projectphaseName = projectphaseName; } public String getProUse() { return proUse; } public void setProUse(String proUse) { this.proUse = proUse; } public String getStoreyHeight() { return storeyHeight; } public void setStoreyHeight(String storeyHeight) { this.storeyHeight = storeyHeight; } public Double getStoreyNum() { return storeyNum; } public void setStoreyNum(Double storeyNum) { this.storeyNum = storeyNum; } public Double getEavesHeight() { return eavesHeight; } public void setEavesHeight(Double eavesHeight) { this.eavesHeight = eavesHeight; } public String getStartWorkDate() { return startWorkDate; } public void setStartWorkDate(String startWorkDate) { this.startWorkDate = startWorkDate; } public String getEndWorkDate() { return endWorkDate; } public void setEndWorkDate(String endWorkDate) { this.endWorkDate = endWorkDate; } public String getStructureType() { return structureType; } public void setStructureType(String structureType) { this.structureType = structureType; } public String getSeismicIntensity() { return seismicIntensity; } public void setSeismicIntensity(String seismicIntensity) { this.seismicIntensity = seismicIntensity; } public String getDecorateStandard() { return decorateStandard; } public void setDecorateStandard(String decorateStandard) { this.decorateStandard = decorateStandard; } public Double getConstructionArea() { return constructionArea; } public void setConstructionArea(Double constructionArea) { this.constructionArea = constructionArea; } public Double getUndergroundArea() { return undergroundArea; } public void setUndergroundArea(Double undergroundArea) { this.undergroundArea = undergroundArea; } public Double getOvergroundArea() { return overgroundArea; } public void setOvergroundArea(Double overgroundArea) { this.overgroundArea = overgroundArea; } public String getAreaUnit() { return areaUnit; } public void setAreaUnit(String areaUnit) { this.areaUnit = areaUnit; } }
ProjectExplainEnum.java
package com.concom.imports.project.enums; /** * 编制说明对应枚举 * @author Cao Zhili * @date 2015年4月23日 */ public enum ProjectExplainEnum { projectname("工程名称","String"),//工程名称 projectaddr("工程地点","String"),//工程地点 otherinfo("其它概况","String"),//工程其它状况 compilationbasis("编制依据","String"),//编制依据 blueprint("图纸","String"),//图纸 designunit("设计单位","String"),//设计单位 designdate("设计日期","String"),//设计日期 designation("图纸名称","String"),//图纸名称 pricingstandard("计价规范","String"),//计价规范 valuationbasis("计价依据","String"),//计价依据 flieno("计价程序表","String"),//计价文件 //2015-7-14新增 proUse("项目用途","String"),//项目用途 storeyHeight("层高(m)","String"), storeyNum("层数:","Double"), overgroundStoreyNum("地上层数:","String"), undergroundStoreyNum("地下层数:","String"), eavesHeight("总高度:","Double"),//檐高 structureType("结构类型","String"), constructionArea("建筑面积","Double"),//建筑面积 undergroundArea("±0.00以上:","Double"),//地下建筑面积 overgroundArea("±0.00以下:","Double");//地上建筑面积 /** * 名称 */ private String name; /** * 类型 */ private String type; /** * 构造方法 * @param name * @param type */ private ProjectExplainEnum(String name, String type){ this.name = name; this.type = type; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getType() { return type; } public void setType(String type) { this.type = type; } }
相关推荐
使用poi解析excel文件,并将数据写入到数据库 项目说明 这个项目实现的功能是读取excel文件中的数据,解析并写入数据库。 读取的excel文件位于项目目录下的 excel\0805.xlsx 使用IntelliJ IDEA开发此项目 使用MYSQL...
Poi excel 读取模板, 复制sheet表 表里面对行的复制的整合 如果看了还有不明白的地方,请留言,谢谢!
poi导出excel统计报表,有合并列的。 根据结构生成层级。poi导出excel统计报表,有合并列的。 根据结构生成层级。
poi获取exccel有合并单元格的数据,存入List
POI解析Excel简单实例
利用 Apache POI 对 excel 操作并存入MySQL数据库的一个小demo。
poi生成excel及合并单元格示例,详见文章http://blog.csdn.net/geloin/article/details/17219885
通过Java Poi 解析EXCEL数据,内附实现代码,绝对可以用。要分不为别的,只为能给个评论。
POI 删除excel列,可以设置多列,POI里怎么没有删除列的API呢
通过poi解析Excel示例
采用poi3.8解析excel文件,内含实例代码和jar包
使用poi解析excel将数据存入Oraclo所用的joi包
poi解析excel2003、2007 poi解析excel2003、2007 poi解析excel2003、2007
利用POI读取excel写入到word 利用POI读取excel写入到word 利用POI读取excel写入到word,压缩包里包含了jar包
自己写的一个poi解析excel 的工具类。里面有些实用的方法,满足基本的解析要求了。
Java操纵POI解析Excel表,根据表头将内容储存。通过实体类set、get方便其它方法引用
POI生成Excel POI读取Excel java操作Excel Servlet生成Excel web项目,包含含读取Excel与生成Excel方法
apache poi解析Excel时报错,我将Excel打开后保存,就不会报错,我将重写的类从新打包这样问题虽然网上有解决方案,但是需要自己打包重写对应类,我已将这些步骤做好了。
在使用poi解析Excel时,会遇缺少很多的包,这里都包括了
NULL 博文链接:https://yxhcquedu.iteye.com/blog/828707