List of usage examples for org.apache.poi.hssf.usermodel HSSFWorkbook getSheet
@Override
public HSSFSheet getSheet(String name)
From source file:TestUtil.java
License:BSD License
private void writeDE(List<Node[]> cdeIdNodes, HSSFWorkbook wb) { HSSFSheet sheet = wb.getSheet("tbl_DATA_ELEMENTS"); int rowNo = -1; for (int i = 0; i < cdeIdNodes.size(); i++) { Node[] cdeIdRow = cdeIdNodes.get(i); Node cdeIdNode = cdeIdRow[0]; if (cdeIdNode != null) { rowNo++;/*from w ww .ja va2 s . c o m*/ String cdeIdRep = cdeIdNode.getTextContent(); String[] cdeIdParts = cdeIdRep.split("v"); if (cdeIdParts != null && cdeIdParts.length >= 2) { HSSFRow row = sheet.createRow(10 + rowNo); HSSFCell seqIdCell = row.createCell(1); HSSFCell longNameCell = row.createCell(2); HSSFCell versionCell = row.createCell(3); HSSFCell ctxIdCell = row.createCell(4); HSSFCell prefNameCell = row.createCell(5); HSSFCell vdIdSeqCell = row.createCell(6); HSSFCell decIdSeqCell = row.createCell(7); HSSFCell prefDefCell = row.createCell(8); HSSFCell aslNameCell = row.createCell(9); HSSFCell dateCreatedCell = row.createCell(10); HSSFCell createdByCell = row.createCell(11); HSSFCell idCell = row.createCell(12); StringBuffer cdeId = new StringBuffer("DE" + rowNo); while (cdeId.length() < 36) { cdeId.append("x"); } seqIdCell.setCellValue(new HSSFRichTextString(cdeId.toString())); ctxIdCell.setCellValue(new HSSFRichTextString("6BF1D8AD-29FB-6CF3-E040-A8C0955834A9")); idCell.setCellValue(Double.parseDouble(cdeIdParts[0])); versionCell.setCellValue(Double.parseDouble(cdeIdParts[1])); if (cdeIdRow.length > 1 && cdeIdRow[1] != null) { longNameCell.setCellValue(new HSSFRichTextString(cdeIdRow[1].getTextContent())); } prefNameCell.setCellValue(new HSSFRichTextString("DE Pref Name" + rowNo)); prefDefCell.setCellValue(new HSSFRichTextString("DE Pref Def" + rowNo)); aslNameCell.setCellValue(new HSSFRichTextString("RELEASED")); dateCreatedCell.setCellValue(new Date()); createdByCell.setCellValue(new HSSFRichTextString("MATHURA")); if (cdeIdRow.length > 2 && cdeIdRow[2] != null) { decIdSeqCell.setCellValue(new HSSFRichTextString(decMap.get(cdeIdRow[2].getTextContent()))); } if (cdeIdRow.length > 3 && cdeIdRow[3] != null) { vdIdSeqCell.setCellValue(new HSSFRichTextString(vdMap.get(cdeIdRow[3].getTextContent()))); } } } } }
From source file:TestUtil.java
License:BSD License
private void writeDEC(List<Node[]> decIdNodes, HSSFWorkbook wb) { HSSFSheet sheet = wb.getSheet("tbl_DATA_ELEMENT_CONCEPTS"); int decRowNum = 9; for (int i = 0; i < decIdNodes.size(); i++) { Node[] decIdRow = decIdNodes.get(i); Node decIdNode = decIdRow[0]; if (decIdNode != null) { String decIdRep = decIdNode.getTextContent(); String[] decIdParts = decIdRep.split("v"); if (decIdParts != null && decIdParts.length >= 2 && !decIds.contains(decIdParts[0])) { decIds.add(decIdParts[0]); decRowNum++;/* ww w . j a va 2 s . c om*/ HSSFRow row = sheet.createRow(decRowNum); HSSFCell seqIdCell = row.createCell(1); HSSFCell versionCell = row.createCell(2); HSSFCell ctxIdCell = row.createCell(4); HSSFCell prefNameCell = row.createCell(3); HSSFCell decIdSeqCell = row.createCell(5); HSSFCell prefDefCell = row.createCell(6); HSSFCell aslNameCell = row.createCell(7); HSSFCell dateCreatedCell = row.createCell(8); HSSFCell createdByCell = row.createCell(9); HSSFCell idCell = row.createCell(10); StringBuffer decId = new StringBuffer("DEC" + i); while (decId.length() < 36) { decId.append("x"); } seqIdCell.setCellValue(new HSSFRichTextString(decId.toString())); ctxIdCell.setCellValue(new HSSFRichTextString("6BF1D8AD-29FB-6CF3-E040-A8C0955834A9")); idCell.setCellValue(Double.parseDouble(decIdParts[0])); versionCell.setCellValue(Double.parseDouble(decIdParts[1].split(":")[0])); prefNameCell.setCellValue(new HSSFRichTextString("DEC Pref Name" + i)); prefDefCell.setCellValue(new HSSFRichTextString("DEC Pref Def" + i)); aslNameCell.setCellValue(new HSSFRichTextString("RELEASED")); dateCreatedCell.setCellValue(new Date()); createdByCell.setCellValue(new HSSFRichTextString("MATHURA")); if (decIdRow.length > 1 && decIdRow[1] != null) { String cdId = decIdRow[1].getTextContent(); if (cdMap.get(cdId) != null) { decIdSeqCell.setCellValue(new HSSFRichTextString(cdMap.get(cdId))); } } decMap.put(decIdRep, decId.toString()); } } } }
From source file:TestUtil.java
License:BSD License
private void writeVD(List<Node[]> vdIdNodes, HSSFWorkbook wb) { HSSFSheet sheet = wb.getSheet("tbl_VALUE_DOMAINS"); int vdRowNum = 9; for (int i = 0; i < vdIdNodes.size(); i++) { Node[] vdIdRow = vdIdNodes.get(i); Node vdIdNode = vdIdRow[0]; if (vdIdNode == null) { if (vdIdRow.length > 1) { String dt = vdIdRow[1].getTextContent().toUpperCase(); if (!dataTypes.contains(dt)) { try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder parser = factory.newDocumentBuilder(); Document doc = parser.newDocument(); org.w3c.dom.Element elem = doc.createElement("node"); elem.setTextContent("1111v1.0:Sample VD"); vdIdNode = elem; } catch (DOMException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); }//from w w w . j a va 2 s. c o m } } } if (vdIdNode != null) { String vdIdRep = vdIdNode.getTextContent(); String[] vdIdParts = vdIdRep.split("v"); if (vdIdParts != null && vdIdParts.length >= 2 && !vdIds.contains(vdIdParts[0])) { vdIds.add(vdIdParts[0]); vdRowNum++; HSSFRow row = sheet.createRow(vdRowNum); HSSFCell seqIdCell = row.createCell(1); HSSFCell versionCell = row.createCell(2); HSSFCell longNameCell = row.createCell(3); HSSFCell ctxIdCell = row.createCell(5); HSSFCell prefNameCell = row.createCell(4); HSSFCell prefDefCell = row.createCell(6); HSSFCell dtlNameCell = row.createCell(7); HSSFCell cdIdSeqCell = row.createCell(8); HSSFCell vdTypeCell = row.createCell(9); HSSFCell aslNameCell = row.createCell(10); HSSFCell dateCreatedCell = row.createCell(11); HSSFCell createdByCell = row.createCell(12); HSSFCell idCell = row.createCell(13); StringBuffer vdId = new StringBuffer("VD" + i); while (vdId.length() < 36) { vdId.append("x"); } seqIdCell.setCellValue(new HSSFRichTextString(vdId.toString())); ctxIdCell.setCellValue(new HSSFRichTextString("6BF1D8AD-29FB-6CF3-E040-A8C0955834A9")); idCell.setCellValue(Double.parseDouble(vdIdParts[0])); versionCell.setCellValue(Double.parseDouble(vdIdParts[1].split(":")[0])); longNameCell.setCellValue(new HSSFRichTextString(vdIdParts[1].split(":")[1])); prefNameCell.setCellValue(new HSSFRichTextString("VD Pref Name" + i)); prefDefCell.setCellValue(new HSSFRichTextString("VD Pref Def" + i)); aslNameCell.setCellValue(new HSSFRichTextString("RELEASED")); dateCreatedCell.setCellValue(new Date()); createdByCell.setCellValue(new HSSFRichTextString("MATHURA")); if (vdIdRow.length > 1 && vdIdRow[1] != null) { dtlNameCell.setCellValue(new HSSFRichTextString(vdIdRow[1].getTextContent().toUpperCase())); } if (vdIdRow.length > 2 && vdIdRow[2] != null) { String enumYesNo = vdIdRow[2].getTextContent(); String enumer = enumYesNo.equalsIgnoreCase("Yes") ? "E" : "N"; vdTypeCell.setCellValue(new HSSFRichTextString(enumer)); } if (vdIdRow.length > 3 && vdIdRow[3] != null) { String cdId = vdIdRow[3].getTextContent(); if (cdMap.get(cdId) != null) { cdIdSeqCell.setCellValue(new HSSFRichTextString(cdMap.get(cdId))); } } vdMap.put(vdIdRep, vdId.toString()); } } } }
From source file:TestUtil.java
License:BSD License
private void writeCD(List<Node[]> cdIdNodes, HSSFWorkbook wb) { HSSFSheet sheet = wb.getSheet("tbl_CONCEPTUAL_DOMAINS"); int cdRowNum = 10; for (int i = 0; i < cdIdNodes.size(); i++) { Node[] cdIdRow = cdIdNodes.get(i); Node cdIdNode = cdIdRow[0]; String cdIdRep = cdIdNode.getTextContent(); String[] cdIdParts = cdIdRep.split("v"); if (cdIdParts != null && cdIdParts.length >= 2 && !cdIds.contains(cdIdParts[0])) { cdIds.add(cdIdParts[0]);// ww w . ja v a 2 s . c om cdRowNum++; HSSFRow row = sheet.createRow(cdRowNum); HSSFCell seqIdCell = row.createCell(1); HSSFCell versionCell = row.createCell(2); HSSFCell ctxIdCell = row.createCell(4); HSSFCell prefNameCell = row.createCell(3); HSSFCell prefDefCell = row.createCell(5); HSSFCell aslNameCell = row.createCell(6); HSSFCell dateCreatedCell = row.createCell(7); HSSFCell createdByCell = row.createCell(8); HSSFCell idCell = row.createCell(9); StringBuffer cdId = new StringBuffer("CD" + i); while (cdId.length() < 36) { cdId.append("x"); } seqIdCell.setCellValue(new HSSFRichTextString(cdId.toString())); ctxIdCell.setCellValue(new HSSFRichTextString("6BF1D8AD-29FB-6CF3-E040-A8C0955834A9")); idCell.setCellValue(Double.parseDouble(cdIdParts[0])); versionCell.setCellValue(Double.parseDouble(cdIdParts[1].split(":")[0])); prefNameCell.setCellValue(new HSSFRichTextString("CD Pref Name" + i)); prefDefCell.setCellValue(new HSSFRichTextString("CD Pref Def" + i)); aslNameCell.setCellValue(new HSSFRichTextString("RELEASED")); dateCreatedCell.setCellValue(new Date()); createdByCell.setCellValue(new HSSFRichTextString("MATHURA")); cdMap.put(cdIdRep, cdId.toString()); } } }
From source file:TestUtil.java
License:BSD License
private void writeCS(Node csNode, HSSFWorkbook wb) { HSSFSheet sheet = wb.getSheet("tbl_CLASSIFICATION_SCHEMES"); HSSFRow row = sheet.getRow(10);/*from ww w .j a va2s . c om*/ HSSFCell prefNameCell = row.createCell(3); HSSFCell longNameCell = row.createCell(4); HSSFCell prefDefCell = row.createCell(5); prefNameCell.setCellValue(new HSSFRichTextString(csNode.getTextContent())); longNameCell.setCellValue(new HSSFRichTextString(csNode.getTextContent())); prefDefCell.setCellValue(new HSSFRichTextString(csNode.getTextContent())); }
From source file:TestUtil.java
License:BSD License
private void writeCSI(Node csiNode, HSSFWorkbook wb) { HSSFSheet sheet = wb.getSheet("tbl_CS_ITEMS"); HSSFRow row = sheet.getRow(10);// w ww .j a v a 2 s .c o m HSSFCell prefNameCell = row.createCell(6); HSSFCell longNameCell = row.createCell(7); HSSFCell prefDefCell = row.createCell(8); prefNameCell.setCellValue(new HSSFRichTextString(csiNode.getTextContent())); longNameCell.setCellValue(new HSSFRichTextString(csiNode.getTextContent())); prefDefCell.setCellValue(new HSSFRichTextString(csiNode.getTextContent())); }
From source file:TestUtil.java
License:BSD License
private void writeCon(List<Node[]> conIdNodes, HSSFWorkbook wb) { HSSFSheet sheet = wb.getSheet("tbl_CONCEPTS_EXT"); int conRowNum = 9; int id = 1110; int j = -1;// w w w.j ava2s. co m for (int i = 0; i < conIdNodes.size(); i++) { Node[] conIdRow = conIdNodes.get(i); Node conIdNode = conIdRow[0]; String conIdRep = conIdNode.getTextContent(); String[] concepts = conIdRep.split(";"); for (String concept : concepts) { j++; String[] cdeIdParts = concept.split(":"); if (cdeIdParts != null && cdeIdParts.length >= 2 && !conIds.contains(cdeIdParts[0])) { String cdeId = cdeIdParts[0].trim(); String longName = cdeIdParts[1].trim(); conIds.add(cdeId); conRowNum++; id++; HSSFRow row = sheet.createRow(conRowNum); HSSFCell seqIdCell = row.createCell(1); HSSFCell versionCell = row.createCell(6); HSSFCell ctxIdCell = row.createCell(5); HSSFCell prefNameCell = row.createCell(2); HSSFCell longNameCell = row.createCell(3); HSSFCell prefDefCell = row.createCell(4); HSSFCell aslNameCell = row.createCell(7); HSSFCell idCell = row.createCell(8); HSSFCell defSourceCell = row.createCell(9); StringBuffer conId = new StringBuffer("CON" + j); while (conId.length() < 36) { conId.append("x"); } seqIdCell.setCellValue(new HSSFRichTextString(conId.toString())); ctxIdCell.setCellValue(new HSSFRichTextString("6BF1D8AD-29FB-6CF3-E040-A8C0955834A9")); idCell.setCellValue(Double.parseDouble(id + "")); versionCell.setCellValue(Double.parseDouble("1.0")); prefNameCell.setCellValue(new HSSFRichTextString(cdeId)); longNameCell.setCellValue(new HSSFRichTextString(longName)); prefDefCell.setCellValue(new HSSFRichTextString("DEC Pref Def" + i)); aslNameCell.setCellValue(new HSSFRichTextString("RELEASED")); defSourceCell.setCellValue(new HSSFRichTextString("NCI")); } } } }
From source file:Almacen.Conciliacion.java
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: try {//from ww w . j av a 2 s .c om javax.swing.JFileChooser archivo = new javax.swing.JFileChooser(); archivo.setFileFilter(new ExtensionFileFilter("Excel document (*.xls)", new String[] { "xls" })); String ruta = null; if (archivo.showSaveDialog(null) == archivo.APPROVE_OPTION) { ruta = archivo.getSelectedFile().getAbsolutePath(); if (ruta != null) { File archivoXLS = new File(ruta + ".xls"); Session session = HibernateUtil.getSessionFactory().openSession(); ArrayList datos = new ArrayList(); Query query = session.createSQLQuery( "select compania.nombre, orden.tipo_nombre, orden.modelo, orden.no_serie, clientes.nombre as nombres,orden.id_orden \n" + "from orden inner join compania on compania.id_compania=orden.id_compania inner join clientes on clientes.id_clientes=orden.id_cliente\n" + "where orden.id_orden=" + Integer.parseInt(orden) + ""); query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP); datos = (ArrayList) query.list(); // Path FROM = Paths.get("imagenes/plantillaConciliacion.xls"); Path TO = Paths.get(ruta + ".xls"); //sobreescribir el fichero de destino, si existe, y copiar // los atributos, incluyendo los permisos rwx CopyOption[] options = new CopyOption[] { StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES }; Files.copy(FROM, TO, options); FileInputStream miPlantilla = new FileInputStream(archivoXLS); POIFSFileSystem fsFileSystem = new POIFSFileSystem(miPlantilla); HSSFWorkbook libro = new HSSFWorkbook(fsFileSystem); libro.getSheet("Conciliacion").getRow(0).getCell(6) .setCellValue("CONCILIACIN PARA FACTURACIN"); for (int i = 0; i < datos.size(); i++) { java.util.HashMap map = (java.util.HashMap) datos.get(i); libro.getSheet("Conciliacion").getRow(1).getCell(2) .setCellValue(map.get("nombre").toString()); libro.getSheet("Conciliacion").getRow(2).getCell(2) .setCellValue(map.get("tipo_nombre").toString()); libro.getSheet("Conciliacion").getRow(3).getCell(2) .setCellValue(map.get("modelo").toString()); libro.getSheet("Conciliacion").getRow(4).getCell(2) .setCellValue(map.get("no_serie").toString()); libro.getSheet("Conciliacion").getRow(5).getCell(2) .setCellValue(map.get("nombres").toString()); libro.getSheet("Conciliacion").getRow(2).getCell(12) .setCellValue(map.get("id_orden").toString()); } HSSFCellStyle borde_d = libro.createCellStyle(); borde_d.setBorderBottom(CellStyle.BORDER_THIN); borde_d.setBorderTop(CellStyle.BORDER_THIN); borde_d.setBorderRight(CellStyle.BORDER_THIN); borde_d.setBorderLeft(CellStyle.BORDER_THIN); borde_d.setAlignment(CellStyle.ALIGN_RIGHT); HSSFCellStyle borde_i = libro.createCellStyle(); borde_i.setBorderBottom(CellStyle.BORDER_THIN); borde_i.setBorderTop(CellStyle.BORDER_THIN); borde_i.setBorderRight(CellStyle.BORDER_THIN); borde_i.setBorderLeft(CellStyle.BORDER_THIN); borde_i.setAlignment(CellStyle.ALIGN_LEFT); HSSFCellStyle borde_c = libro.createCellStyle(); borde_c.setBorderBottom(CellStyle.BORDER_THIN); borde_c.setBorderTop(CellStyle.BORDER_THIN); borde_c.setBorderRight(CellStyle.BORDER_THIN); borde_c.setBorderLeft(CellStyle.BORDER_THIN); borde_c.setAlignment(CellStyle.ALIGN_CENTER); HSSFCellStyle borde_dr = libro.createCellStyle(); borde_dr.setBorderBottom(CellStyle.BORDER_THIN); borde_dr.setBorderTop(CellStyle.BORDER_THIN); borde_dr.setBorderRight(CellStyle.BORDER_THIN); borde_dr.setBorderLeft(CellStyle.BORDER_THIN); borde_dr.setAlignment(CellStyle.ALIGN_RIGHT); borde_dr.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); borde_dr.setFillBackgroundColor(HSSFColor.LIGHT_BLUE.index); borde_dr.setFillForegroundColor(HSSFColor.YELLOW.index); HSSFCellStyle borde_ir = libro.createCellStyle(); borde_ir.setBorderBottom(CellStyle.BORDER_THIN); borde_ir.setBorderTop(CellStyle.BORDER_THIN); borde_ir.setBorderRight(CellStyle.BORDER_THIN); borde_ir.setBorderLeft(CellStyle.BORDER_THIN); borde_ir.setAlignment(CellStyle.ALIGN_LEFT); borde_ir.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); borde_ir.setFillBackgroundColor(HSSFColor.LIGHT_BLUE.index); borde_ir.setFillForegroundColor(HSSFColor.YELLOW.index); HSSFCellStyle borde_cr = libro.createCellStyle(); borde_cr.setBorderBottom(CellStyle.BORDER_THIN); borde_cr.setBorderTop(CellStyle.BORDER_THIN); borde_cr.setBorderRight(CellStyle.BORDER_THIN); borde_cr.setBorderLeft(CellStyle.BORDER_THIN); borde_cr.setAlignment(CellStyle.ALIGN_CENTER); borde_cr.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); borde_cr.setFillBackgroundColor(HSSFColor.LIGHT_BLUE.index); borde_cr.setFillForegroundColor(HSSFColor.YELLOW.index); DecimalFormat formatoPorcentaje = new DecimalFormat("#,##0.00"); int miRenglon = 9; int num_tab = t_datos.getRowCount(); for (int i = 0; i < num_tab; i++) { for (int j = 0; j < 4; j++) { int renglon = 0; switch (j) { case 0: renglon = 8; break; case 1: renglon = 10; break; case 2: renglon = 11; break; case 3: renglon = 12; break; } if ((Double.parseDouble(t_datos.getValueAt(i, renglon).toString()) > 0 && t_datos.getValueAt(i, 9).toString().compareTo("N") == 0) || ((Double.parseDouble(t_datos.getValueAt(i, renglon).toString()) > 0 && renglon >= 10)) || (renglon == 8 && Double.parseDouble(t_datos.getValueAt(i, 10).toString()) <= 0 && Double.parseDouble(t_datos.getValueAt(i, 11).toString()) <= 0 && Double.parseDouble(t_datos.getValueAt(i, 12).toString()) <= 0)) { if ((boolean) t_datos.getValueAt(i, 3) == true || (boolean) t_datos.getValueAt(i, 4) == true) { libro.getSheet("Conciliacion").createRow(miRenglon); //columna0 if (t_datos.getValueAt(i, 5) == null) { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(0) .setCellValue(""); } else { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(0) .setCellValue(t_datos.getValueAt(i, 5).toString()); } //columna1 if (t_datos.getValueAt(i, 6) == null) { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(1) .setCellValue(""); } else { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(1) .setCellValue(t_datos.getValueAt(i, 6).toString()); } //columna2 libro.getSheet("Conciliacion").getRow(miRenglon).createCell(2) .setCellValue(t_datos.getValueAt(i, renglon).toString()); //columna3 if (t_datos.getValueAt(i, 14) == null) { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(3) .setCellValue(""); } else { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(3) .setCellValue(t_datos.getValueAt(i, 14).toString()); } //columna4 libro.getSheet("Conciliacion").getRow(miRenglon).createCell(4) .setCellValue(t_datos.getValueAt(i, 2).toString()); //columna5 if (renglon == 8 && t_datos.getValueAt(i, 9).toString().compareTo("-") == 0) libro.getSheet("Conciliacion").getRow(miRenglon).createCell(5) .setCellValue(""); else { switch (renglon) { case 8: libro.getSheet("Conciliacion").getRow(miRenglon).createCell(5) .setCellValue("N"); break; case 10: libro.getSheet("Conciliacion").getRow(miRenglon).createCell(5) .setCellValue("D"); break; case 11: libro.getSheet("Conciliacion").getRow(miRenglon).createCell(5) .setCellValue("R"); break; case 12: libro.getSheet("Conciliacion").getRow(miRenglon).createCell(5) .setCellValue("M"); break; } } //columna6 libro.getSheet("Conciliacion").getRow(miRenglon).createCell(6) .setCellValue(formatoPorcentaje.format(t_datos.getValueAt(i, 15))); //columna7 $tot aut. double n; n = BigDecimal .valueOf(Double.parseDouble(t_datos.getValueAt(i, renglon).toString()) * Double.parseDouble(t_datos.getValueAt(i, 15).toString())) .setScale(2, RoundingMode.UP).doubleValue(); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(7) .setCellValue(formatoPorcentaje.format(n)); //columna8 libro.getSheet("Conciliacion").getRow(miRenglon).createCell(8) .setCellValue(formatoPorcentaje.format(t_datos.getValueAt(i, 16))); //columna9 $tot com n = BigDecimal .valueOf(Double.parseDouble(t_datos.getValueAt(i, renglon).toString()) * Double.parseDouble(t_datos.getValueAt(i, 16).toString())) .setScale(2, RoundingMode.UP).doubleValue(); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(9) .setCellValue(formatoPorcentaje.format(n)); //columna10 11 if (renglon == 8 && t_datos.getValueAt(i, 9).toString().compareTo("-") == 0) { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(10) .setCellValue(""); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(11) .setCellValue(""); } else { switch (renglon) { case 8: n = BigDecimal.valueOf( Double.parseDouble(t_datos.getValueAt(i, 16).toString()) / 0.9d) .setScale(2, RoundingMode.UP).doubleValue(); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(11) .setCellValue(formatoPorcentaje.format(n * Double.parseDouble( t_datos.getValueAt(i, renglon).toString()))); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(10) .setCellValue(formatoPorcentaje.format(n)); break; case 10: n = BigDecimal .valueOf( Double.parseDouble(t_datos.getValueAt(i, 15).toString()) * 0.72d) .setScale(2, RoundingMode.UP).doubleValue(); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(11) .setCellValue(formatoPorcentaje.format(n * Double.parseDouble( t_datos.getValueAt(i, renglon).toString()))); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(10) .setCellValue(formatoPorcentaje.format(n)); break; case 11: n = BigDecimal .valueOf( Double.parseDouble(t_datos.getValueAt(i, 15).toString()) * 0.65d) .setScale(2, RoundingMode.UP).doubleValue(); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(11) .setCellValue(formatoPorcentaje.format(n * Double.parseDouble( t_datos.getValueAt(i, renglon).toString()))); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(10) .setCellValue(formatoPorcentaje.format(n)); break; case 12: n = BigDecimal .valueOf( Double.parseDouble(t_datos.getValueAt(i, 15).toString()) * 0.65d) .setScale(2, RoundingMode.UP).doubleValue(); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(11) .setCellValue(formatoPorcentaje.format(n * Double.parseDouble( t_datos.getValueAt(i, renglon).toString()))); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(10) .setCellValue(formatoPorcentaje.format(n)); break; } } //columna12 if (t_datos.getValueAt(i, 18) == null) { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(12) .setCellValue(""); } else { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(12) .setCellValue(t_datos.getValueAt(i, 18).toString()); } //columna13 if (t_datos.getValueAt(i, 19) == null) { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(13) .setCellValue(""); } else { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(13) .setCellValue(t_datos.getValueAt(i, 19).toString()); } //columna14 libro.getSheet("Conciliacion").getRow(miRenglon).createCell(14) .setCellValue("V"); if (renglon == 8 && t_datos.getValueAt(i, 9).toString().compareTo("-") == 0) { libro.getSheet("Conciliacion").getRow(miRenglon).getCell(0) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(1) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(2) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(3) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(4) .setCellStyle(borde_i); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(5) .setCellStyle(borde_c); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(6) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(7) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(8) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(9) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(10) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(11) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(12) .setCellStyle(borde_i); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(13) .setCellStyle(borde_i); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(14) .setCellStyle(borde_d); } else { libro.getSheet("Conciliacion").getRow(miRenglon).getCell(0) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(1) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(2) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(3) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(4) .setCellStyle(borde_ir); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(5) .setCellStyle(borde_cr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(6) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(7) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(8) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(9) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(10) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(11) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(12) .setCellStyle(borde_ir); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(13) .setCellStyle(borde_ir); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(14) .setCellStyle(borde_dr); } miRenglon++; } } } } //font1.setColor(BaseColor.WHITE); libro.getSheet("Conciliacion").createRow(miRenglon); libro.getSheet("Conciliacion") .addMergedRegion(new CellRangeAddress(miRenglon, miRenglon, 0, 14)); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(0) .setCellValue("Faltante en Vales"); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(0).setCellStyle(borde_c); miRenglon++; for (int i = 0; i < num_tab; i++) { for (int j = 0; j < 4; j++) { int renglon = 0; switch (j) { case 0: renglon = 8; break; case 1: renglon = 10; break; case 2: renglon = 11; break; case 3: renglon = 12; break; } if ((Double.parseDouble(t_datos.getValueAt(i, renglon).toString()) > 0 && t_datos.getValueAt(i, 9).toString().compareTo("N") == 0) || ((Double.parseDouble(t_datos.getValueAt(i, renglon).toString()) > 0 && renglon >= 10)) || (renglon == 8 && Double.parseDouble(t_datos.getValueAt(i, 10).toString()) <= 0 && Double.parseDouble(t_datos.getValueAt(i, 11).toString()) <= 0 && Double.parseDouble(t_datos.getValueAt(i, 12).toString()) <= 0)) { if ((boolean) t_datos.getValueAt(i, 3) == false && (boolean) t_datos.getValueAt(i, 4) == false && t_datos.getValueAt(i, 5) != null) { libro.getSheet("Conciliacion").createRow(miRenglon); //columna0 if (t_datos.getValueAt(i, 5) == null) { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(0) .setCellValue(""); } else { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(0) .setCellValue(t_datos.getValueAt(i, 5).toString()); } //columna1 if (t_datos.getValueAt(i, 6) == null) { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(1) .setCellValue(""); } else { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(1) .setCellValue(t_datos.getValueAt(i, 6).toString()); } //columna2 libro.getSheet("Conciliacion").getRow(miRenglon).createCell(2) .setCellValue(t_datos.getValueAt(i, renglon).toString()); //columna3 if (t_datos.getValueAt(i, 14) == null) { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(3) .setCellValue(""); } else { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(3) .setCellValue(t_datos.getValueAt(i, 14).toString()); } //columna4 libro.getSheet("Conciliacion").getRow(miRenglon).createCell(4) .setCellValue(t_datos.getValueAt(i, 2).toString()); //columna5 if (renglon == 8 && t_datos.getValueAt(i, 9).toString().compareTo("-") == 0) libro.getSheet("Conciliacion").getRow(miRenglon).createCell(5) .setCellValue(""); else { switch (renglon) { case 8: libro.getSheet("Conciliacion").getRow(miRenglon).createCell(5) .setCellValue("N"); break; case 10: libro.getSheet("Conciliacion").getRow(miRenglon).createCell(5) .setCellValue("D"); break; case 11: libro.getSheet("Conciliacion").getRow(miRenglon).createCell(5) .setCellValue("R"); break; case 12: libro.getSheet("Conciliacion").getRow(miRenglon).createCell(5) .setCellValue("M"); break; } } //columna6 libro.getSheet("Conciliacion").getRow(miRenglon).createCell(6) .setCellValue(formatoPorcentaje.format(t_datos.getValueAt(i, 15))); //columna7 $tot aut. double n; n = BigDecimal .valueOf(Double.parseDouble(t_datos.getValueAt(i, renglon).toString()) * Double.parseDouble(t_datos.getValueAt(i, 15).toString())) .setScale(2, RoundingMode.UP).doubleValue(); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(7) .setCellValue(formatoPorcentaje.format(n)); //columna8 libro.getSheet("Conciliacion").getRow(miRenglon).createCell(8) .setCellValue(formatoPorcentaje.format(t_datos.getValueAt(i, 16))); //columna9 $tot com n = BigDecimal .valueOf(Double.parseDouble(t_datos.getValueAt(i, renglon).toString()) * Double.parseDouble(t_datos.getValueAt(i, 16).toString())) .setScale(2, RoundingMode.UP).doubleValue(); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(9) .setCellValue(formatoPorcentaje.format(n)); //columna10 11 if (renglon == 8 && t_datos.getValueAt(i, 9).toString().compareTo("-") == 0) { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(10) .setCellValue(""); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(11) .setCellValue(""); } else { switch (renglon) { case 8: n = BigDecimal.valueOf( Double.parseDouble(t_datos.getValueAt(i, 16).toString()) / 0.9d) .setScale(2, RoundingMode.UP).doubleValue(); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(10) .setCellValue(formatoPorcentaje.format(n * Double.parseDouble( t_datos.getValueAt(i, renglon).toString()))); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(11) .setCellValue(formatoPorcentaje.format(n)); break; case 10: n = BigDecimal .valueOf( Double.parseDouble(t_datos.getValueAt(i, 15).toString()) * 0.72d) .setScale(2, RoundingMode.UP).doubleValue(); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(10) .setCellValue(formatoPorcentaje.format(n * Double.parseDouble( t_datos.getValueAt(i, renglon).toString()))); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(11) .setCellValue(formatoPorcentaje.format(n)); break; case 11: n = BigDecimal .valueOf( Double.parseDouble(t_datos.getValueAt(i, 15).toString()) * 0.65d) .setScale(2, RoundingMode.UP).doubleValue(); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(10) .setCellValue(formatoPorcentaje.format(n * Double.parseDouble( t_datos.getValueAt(i, renglon).toString()))); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(11) .setCellValue(formatoPorcentaje.format(n)); break; case 12: n = BigDecimal .valueOf( Double.parseDouble(t_datos.getValueAt(i, 15).toString()) * 0.65d) .setScale(2, RoundingMode.UP).doubleValue(); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(10) .setCellValue(formatoPorcentaje.format(n * Double.parseDouble( t_datos.getValueAt(i, renglon).toString()))); libro.getSheet("Conciliacion").getRow(miRenglon).createCell(11) .setCellValue(formatoPorcentaje.format(n)); break; } } //columna12 if (t_datos.getValueAt(i, 18) == null) { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(12) .setCellValue(""); } else { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(12) .setCellValue(t_datos.getValueAt(i, 18).toString()); } //columna13 if (t_datos.getValueAt(i, 19) == null) { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(13) .setCellValue(""); } else { libro.getSheet("Conciliacion").getRow(miRenglon).createCell(13) .setCellValue(t_datos.getValueAt(i, 19).toString()); } //columna14 libro.getSheet("Conciliacion").getRow(miRenglon).createCell(14) .setCellValue(""); if (renglon == 8 && t_datos.getValueAt(i, 9).toString().compareTo("-") == 0) { libro.getSheet("Conciliacion").getRow(miRenglon).getCell(0) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(1) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(2) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(3) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(4) .setCellStyle(borde_i); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(5) .setCellStyle(borde_c); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(6) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(7) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(8) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(9) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(10) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(11) .setCellStyle(borde_d); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(12) .setCellStyle(borde_i); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(13) .setCellStyle(borde_i); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(14) .setCellStyle(borde_d); } else { libro.getSheet("Conciliacion").getRow(miRenglon).getCell(0) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(1) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(2) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(3) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(4) .setCellStyle(borde_ir); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(5) .setCellStyle(borde_cr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(6) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(7) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(8) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(9) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(10) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(11) .setCellStyle(borde_dr); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(12) .setCellStyle(borde_ir); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(13) .setCellStyle(borde_ir); libro.getSheet("Conciliacion").getRow(miRenglon).getCell(14) .setCellStyle(borde_dr); } miRenglon++; } } } } FileOutputStream archivo1 = new FileOutputStream(archivoXLS); libro.write(archivo1); archivo1.close(); Desktop.getDesktop().open(archivoXLS); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:cdc.impl.datasource.office.ExcelDataSource.java
License:LGPL
private static DataColumnDefinition[] readDataModel(String sourceName, Map params) throws IOException, RJException { BufferedInputStream is = null; try {//from w w w . java 2s .c om is = new BufferedInputStream(new FileInputStream((String) params.get(PARAM_FILE))); HSSFWorkbook wb = new HSSFWorkbook(new POIFSFileSystem(is)); String[] sheets; if (params.get(PARAM_SHEET) != null) { sheets = new String[] { (String) params.get(PARAM_SHEET) }; } else { sheets = new String[wb.getNumberOfSheets()]; for (int i = 0; i < sheets.length; i++) { sheets[i] = wb.getSheetName(i); } } if (sheets.length == 0) { throw new RJException("Excel file " + params.get(PARAM_FILE) + " does not provide any sheets."); } List cols = new ArrayList(); HSSFSheet sheet = wb.getSheet(sheets[0]); if (sheet == null) { //System.out.println("Thorwing: " + "Sheet " + sheets[0] + " is not provided by file " + params.get(PARAM_FILE)); throw new RJException( "Sheet '" + sheets[0] + "' is not provided by file " + params.get(PARAM_FILE)); } HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(sheet, wb); //first row should provide data model HSSFRow row = sheet.getRow(0); evaluator.setCurrentRow(row); for (int i = 0; i < row.getPhysicalNumberOfCells(); i++) { HSSFCell cell = row.getCell(i); cols.add(new ExcelDataColumnDefinition(decodeValue(cell, evaluator), DataColumnDefinition.TYPE_STRING, sourceName, i)); } for (int i = 1; i < sheets.length; i++) { sheet = wb.getSheet(sheets[i]); if (sheet == null) { throw new RJException("Sheet '" + params.get(PARAM_SHEET) + "' is not provided by file " + params.get(PARAM_FILE)); } evaluator = new HSSFFormulaEvaluator(sheet, wb); //first row should provide data model row = sheet.getRow(0); evaluator.setCurrentRow(row); List localCols = new ArrayList(); for (i = 0; i < row.getPhysicalNumberOfCells(); i++) { HSSFCell cell = row.getCell(i); DataColumnDefinition col = new ExcelDataColumnDefinition(decodeValue(cell, evaluator), DataColumnDefinition.TYPE_STRING, sourceName, i); localCols.add(col); } List toRemove = new ArrayList(); for (Iterator iterator = cols.iterator(); iterator.hasNext();) { DataColumnDefinition object = (DataColumnDefinition) iterator.next(); if (!localCols.contains(object)) { toRemove.add(object); } } cols.removeAll(toRemove); } return (DataColumnDefinition[]) cols.toArray(new DataColumnDefinition[] {}); } finally { if (is != null) { is.close(); } } }
From source file:com.asakusafw.testtools.excel.ExcelUtilsTest.java
License:Apache License
/** * getXXXoption()?/*from w w w . ja v a 2 s.c o m*/ * @throws Exception */ @SuppressWarnings("deprecation") @Test public void testGetXXXOption() throws Exception { String filename = "src/test/data/Excel/ExcelUtils/ALLT_TYPES.xls"; // ?EXCEL? InputStream is = new FileInputStream(filename); HSSFWorkbook workbook = new HSSFWorkbook(is); HSSFSheet sheet = workbook.getSheet(Constants.OUTPUT_DATA_SHEET_NAME); // ?ExcelUtils? ExcelUtils excelUtils = new ExcelUtils(filename); // getLongOption? LongOption longOption = new LongOption(); longOption.modify(0); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_0, TYPES.BIGINT, longOption); longOption.modify(1); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_1, TYPES.BIGINT, longOption); longOption.modify(-1); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MINUS1, TYPES.BIGINT, longOption); longOption.modify(ExcelUtils.EXCEL_MAX_LONG); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MAX, TYPES.BIGINT, longOption); longOption.modify(ExcelUtils.EXCEL_MIN_LONG); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MIN, TYPES.BIGINT, longOption); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DECIMAL, TYPES.BIGINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_OVER_MAX, TYPES.BIGINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_UNDER_MIN, TYPES.BIGINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_BIG_VALUE, TYPES.BIGINT, new NumberFormatException("????")); longOption.modify(0); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_0, TYPES.BIGINT, longOption); longOption.modify(1); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_1, TYPES.BIGINT, longOption); longOption.modify(-1); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MINUS1, TYPES.BIGINT, longOption); longOption.modify(Long.MAX_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MAX, TYPES.BIGINT, longOption); longOption.modify(Long.MIN_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MIN, TYPES.BIGINT, longOption); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DECIMAL, TYPES.BIGINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_OVER_MAX, TYPES.BIGINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_UNDER_MIN, TYPES.BIGINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_BIG_VALUE, TYPES.BIGINT, new CellTypeMismatchException("")); longOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.BLANK, TYPES.BIGINT, longOption); longOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.NULL_STRING, TYPES.BIGINT, new CellTypeMismatchException("")); longOption.modify(1); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_TRUE, TYPES.BIGINT, longOption); longOption.modify(0); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_FALSE, TYPES.BIGINT, longOption); longOption.modify(40179); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATE, TYPES.BIGINT, longOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT1, TYPES.BIGINT, longOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT2, TYPES.BIGINT, longOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT1, TYPES.BIGINT, longOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT2, TYPES.BIGINT, longOption); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATE, TYPES.BIGINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATETIME, TYPES.BIGINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT1, TYPES.BIGINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT2, TYPES.BIGINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT1, TYPES.BIGINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT2, TYPES.BIGINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATETIME, TYPES.BIGINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.ERROR, TYPES.BIGINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.FORMULA, TYPES.BIGINT, new CellTypeMismatchException("")); // getIntOption? IntOption intOption = new IntOption(); intOption.modify(0); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_0, TYPES.INT, intOption); intOption.modify(1); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_1, TYPES.INT, intOption); intOption.modify(-1); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MINUS1, TYPES.INT, intOption); intOption.modify(Integer.MAX_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MAX, TYPES.INT, intOption); intOption.modify(Integer.MIN_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MIN, TYPES.INT, intOption); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DECIMAL, TYPES.INT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_OVER_MAX, TYPES.INT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_UNDER_MIN, TYPES.INT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_BIG_VALUE, TYPES.INT, new NumberFormatException("????")); intOption.modify(0); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_0, TYPES.INT, intOption); intOption.modify(1); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_1, TYPES.INT, intOption); intOption.modify(-1); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MINUS1, TYPES.INT, intOption); intOption.modify(Integer.MAX_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MAX, TYPES.INT, intOption); intOption.modify(Integer.MIN_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MIN, TYPES.INT, intOption); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DECIMAL, TYPES.INT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_OVER_MAX, TYPES.INT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_UNDER_MIN, TYPES.INT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_BIG_VALUE, TYPES.INT, new CellTypeMismatchException("")); intOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.BLANK, TYPES.INT, intOption); longOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.NULL_STRING, TYPES.INT, new CellTypeMismatchException("")); intOption.modify(1); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_TRUE, TYPES.INT, intOption); intOption.modify(0); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_FALSE, TYPES.INT, intOption); intOption.modify(40179); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATE, TYPES.INT, intOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT1, TYPES.INT, intOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT2, TYPES.INT, intOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT1, TYPES.INT, intOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT2, TYPES.INT, intOption); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATE, TYPES.INT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATETIME, TYPES.INT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT1, TYPES.INT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT2, TYPES.INT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT1, TYPES.INT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT2, TYPES.INT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATETIME, TYPES.INT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.ERROR, TYPES.INT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.FORMULA, TYPES.INT, new CellTypeMismatchException("")); // getShortOption? ShortOption shortOption = new ShortOption(); shortOption.modify((short) 0); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_0, TYPES.SMALLINT, shortOption); shortOption.modify((short) 1); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_1, TYPES.SMALLINT, shortOption); shortOption.modify((short) -1); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MINUS1, TYPES.SMALLINT, shortOption); shortOption.modify(Short.MAX_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MAX, TYPES.SMALLINT, shortOption); shortOption.modify(Short.MIN_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MIN, TYPES.SMALLINT, shortOption); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DECIMAL, TYPES.SMALLINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_OVER_MAX, TYPES.SMALLINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_UNDER_MIN, TYPES.SMALLINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_BIG_VALUE, TYPES.SMALLINT, new NumberFormatException("????")); shortOption.modify((short) 0); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_0, TYPES.SMALLINT, shortOption); shortOption.modify((short) 1); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_1, TYPES.SMALLINT, shortOption); shortOption.modify((short) -1); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MINUS1, TYPES.SMALLINT, shortOption); shortOption.modify(Short.MAX_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MAX, TYPES.SMALLINT, shortOption); shortOption.modify(Short.MIN_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MIN, TYPES.SMALLINT, shortOption); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DECIMAL, TYPES.SMALLINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_OVER_MAX, TYPES.SMALLINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_UNDER_MIN, TYPES.SMALLINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_BIG_VALUE, TYPES.SMALLINT, new CellTypeMismatchException("")); shortOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.BLANK, TYPES.SMALLINT, shortOption); longOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.NULL_STRING, TYPES.SMALLINT, new CellTypeMismatchException("")); shortOption.modify((short) 1); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_TRUE, TYPES.SMALLINT, shortOption); shortOption.modify((short) 0); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_FALSE, TYPES.SMALLINT, shortOption); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATE, TYPES.SMALLINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT1, TYPES.SMALLINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT2, TYPES.SMALLINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT1, TYPES.SMALLINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT2, TYPES.SMALLINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATE, TYPES.SMALLINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATETIME, TYPES.SMALLINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT1, TYPES.SMALLINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT2, TYPES.SMALLINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT1, TYPES.SMALLINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT2, TYPES.SMALLINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATETIME, TYPES.SMALLINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.ERROR, TYPES.SMALLINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.FORMULA, TYPES.SMALLINT, new CellTypeMismatchException("")); // getByteOption? ByteOption byteOption = new ByteOption(); byteOption.modify((byte) 0); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_0, TYPES.TINYINT, byteOption); byteOption.modify((byte) 1); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_1, TYPES.TINYINT, byteOption); byteOption.modify((byte) -1); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MINUS1, TYPES.TINYINT, byteOption); byteOption.modify(Byte.MAX_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MAX, TYPES.TINYINT, byteOption); byteOption.modify(Byte.MIN_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MIN, TYPES.TINYINT, byteOption); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DECIMAL, TYPES.TINYINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_OVER_MAX, TYPES.TINYINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_UNDER_MIN, TYPES.TINYINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_BIG_VALUE, TYPES.TINYINT, new NumberFormatException("????")); byteOption.modify((byte) 0); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_0, TYPES.TINYINT, byteOption); byteOption.modify((byte) 1); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_1, TYPES.TINYINT, byteOption); byteOption.modify((byte) -1); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MINUS1, TYPES.TINYINT, byteOption); byteOption.modify(Byte.MAX_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MAX, TYPES.TINYINT, byteOption); byteOption.modify(Byte.MIN_VALUE); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MIN, TYPES.TINYINT, byteOption); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DECIMAL, TYPES.TINYINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_OVER_MAX, TYPES.TINYINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_UNDER_MIN, TYPES.TINYINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_BIG_VALUE, TYPES.TINYINT, new CellTypeMismatchException("")); byteOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.BLANK, TYPES.TINYINT, byteOption); longOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.NULL_STRING, TYPES.TINYINT, new CellTypeMismatchException("")); byteOption.modify((byte) 1); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_TRUE, TYPES.TINYINT, byteOption); byteOption.modify((byte) 0); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_FALSE, TYPES.TINYINT, byteOption); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATE, TYPES.TINYINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT1, TYPES.TINYINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT2, TYPES.TINYINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT1, TYPES.TINYINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT2, TYPES.TINYINT, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATE, TYPES.TINYINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATETIME, TYPES.TINYINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT1, TYPES.TINYINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT2, TYPES.TINYINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT1, TYPES.TINYINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT2, TYPES.TINYINT, new NumberFormatException("??????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATETIME, TYPES.TINYINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.ERROR, TYPES.TINYINT, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.FORMULA, TYPES.TINYINT, new CellTypeMismatchException("")); // getStringOption? StringOption stringOption = new StringOption(); stringOption.modify("0"); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_0, TYPES.CHAR, stringOption); stringOption.modify("1"); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_1, TYPES.CHAR, stringOption); stringOption.modify("-1"); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MINUS1, TYPES.CHAR, stringOption); stringOption.modify("6.54321"); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DECIMAL, TYPES.CHAR, stringOption); stringOption.modify("9.2233720368547697E18"); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_OVER_MAX, TYPES.CHAR, stringOption); stringOption.modify("-9.2233720368547697E18"); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_UNDER_MIN, TYPES.CHAR, stringOption); stringOption.modify("1.23456789012345E19"); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_BIG_VALUE, TYPES.CHAR, stringOption); stringOption.modify("0"); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_0, TYPES.CHAR, stringOption); stringOption.modify("1"); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_1, TYPES.CHAR, stringOption); stringOption.modify("-1"); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MINUS1, TYPES.CHAR, stringOption); stringOption.modify("6.54321"); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DECIMAL, TYPES.CHAR, stringOption); stringOption.modify("9223372036854775808"); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_OVER_MAX, TYPES.CHAR, stringOption); stringOption.modify("-9223372036854775809"); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_UNDER_MIN, TYPES.CHAR, stringOption); stringOption.modify("12345678901234567890"); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_BIG_VALUE, TYPES.CHAR, stringOption); stringOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.BLANK, TYPES.CHAR, stringOption); stringOption.modify(""); testGetXXXOptionDo(excelUtils, sheet, DATA.NULL_STRING, TYPES.CHAR, stringOption); stringOption.modify("1"); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_TRUE, TYPES.CHAR, stringOption); stringOption.modify("0"); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_FALSE, TYPES.CHAR, stringOption); stringOption.modify("40179"); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATE, TYPES.CHAR, stringOption); stringOption.modify("2010-01-01 00:00:00"); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT1, TYPES.CHAR, stringOption); stringOption.modify("2010-01-01 00:00:00"); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT2, TYPES.CHAR, stringOption); stringOption.modify("2010-01-01 00:00:00"); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT1, TYPES.CHAR, stringOption); stringOption.modify("2010-01-01 00:00:00"); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT2, TYPES.CHAR, stringOption); stringOption.modify("2010-01-01"); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATE, TYPES.CHAR, stringOption); stringOption.modify("40452.50090277778"); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATETIME, TYPES.CHAR, stringOption); stringOption.modify("2010-10-01 12:01:18"); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT1, TYPES.CHAR, stringOption); stringOption.modify("2010-10-01 12:01:18"); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT2, TYPES.CHAR, stringOption); stringOption.modify("2010-10-01 12:01:18"); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT1, TYPES.CHAR, stringOption); stringOption.modify("2010-10-01 12:01:18"); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT2, TYPES.CHAR, stringOption); stringOption.modify("2010-10-01 12:01:18"); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATETIME, TYPES.CHAR, stringOption); testGetXXXOptionDo(excelUtils, sheet, DATA.ERROR, TYPES.CHAR, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.FORMULA, TYPES.CHAR, new CellTypeMismatchException("")); // getDateOption? DateOption dateOption = new DateOption(); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_0, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_1, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MINUS1, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DECIMAL, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_OVER_MAX, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_UNDER_MIN, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_BIG_VALUE, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_0, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_1, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MINUS1, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DECIMAL, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_OVER_MAX, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_UNDER_MIN, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_BIG_VALUE, TYPES.DATE, new CellTypeMismatchException("")); dateOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.BLANK, TYPES.DATE, dateOption); testGetXXXOptionDo(excelUtils, sheet, DATA.NULL_STRING, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_TRUE, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_FALSE, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATE, TYPES.DATE, new CellTypeMismatchException("")); dateOption.modify(DateUtil.getDayFromDate(2010, 1, 1)); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT1, TYPES.DATE, dateOption); dateOption.modify(DateUtil.getDayFromDate(2010, 1, 1)); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT2, TYPES.DATE, dateOption); dateOption.modify(DateUtil.getDayFromDate(2010, 1, 1)); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT1, TYPES.DATE, dateOption); dateOption.modify(DateUtil.getDayFromDate(2010, 1, 1)); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT2, TYPES.DATE, dateOption); dateOption.modify(DateUtil.getDayFromDate(2010, 1, 1)); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATE, TYPES.DATE, dateOption); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATETIME, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT1, TYPES.DATE, new CellTypeMismatchException("?0???????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT2, TYPES.DATE, new CellTypeMismatchException("?0???????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT1, TYPES.DATE, new CellTypeMismatchException("?0???????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT2, TYPES.DATE, new CellTypeMismatchException("?0???????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATETIME, TYPES.DATE, new CellTypeMismatchException("?0???????????")); testGetXXXOptionDo(excelUtils, sheet, DATA.ERROR, TYPES.DATE, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.FORMULA, TYPES.DATE, new CellTypeMismatchException("")); // getDateTimeOption? DateTimeOption dateTimeOption = new DateTimeOption(); DateTime dateTime = new DateTime(); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_0, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_1, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MINUS1, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DECIMAL, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_OVER_MAX, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_UNDER_MIN, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_BIG_VALUE, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_0, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_1, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MINUS1, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DECIMAL, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_OVER_MAX, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_UNDER_MIN, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_BIG_VALUE, TYPES.DATETIME, new CellTypeMismatchException("")); dateTimeOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.BLANK, TYPES.DATETIME, dateTimeOption); testGetXXXOptionDo(excelUtils, sheet, DATA.NULL_STRING, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_TRUE, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_FALSE, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATE, TYPES.DATETIME, new CellTypeMismatchException("")); dateTime.setElapsedSeconds(DateUtil.getDayFromDate(2010, 1, 1) * 86400L); dateTimeOption.modify(dateTime); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT1, TYPES.DATETIME, dateTimeOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT2, TYPES.DATETIME, dateTimeOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT1, TYPES.DATETIME, dateTimeOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT2, TYPES.DATETIME, dateTimeOption); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATE, TYPES.DATETIME, dateTimeOption); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATETIME, TYPES.DATETIME, new CellTypeMismatchException("")); dateTime.setElapsedSeconds( DateUtil.getDayFromDate(2010, 10, 1) * 86400L + DateUtil.getSecondFromTime(12, 1, 18)); dateTimeOption.modify(dateTime); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT1, TYPES.DATETIME, dateTimeOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT2, TYPES.DATETIME, dateTimeOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT1, TYPES.DATETIME, dateTimeOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT2, TYPES.DATETIME, dateTimeOption); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATETIME, TYPES.DATETIME, dateTimeOption); testGetXXXOptionDo(excelUtils, sheet, DATA.ERROR, TYPES.DATETIME, new CellTypeMismatchException("")); testGetXXXOptionDo(excelUtils, sheet, DATA.FORMULA, TYPES.DATETIME, new CellTypeMismatchException("")); // getDecimalOption? DecimalOption decimalOption = new DecimalOption(); decimalOption.modify(new BigDecimal("0")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_0, TYPES.DECIMAL, decimalOption); decimalOption.modify(new BigDecimal("1")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_1, TYPES.DECIMAL, decimalOption); decimalOption.modify(new BigDecimal("-1")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MINUS1, TYPES.DECIMAL, decimalOption); decimalOption.modify(new BigDecimal("999999999999999")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MAX, TYPES.DECIMAL, decimalOption); decimalOption.modify(new BigDecimal("-999999999999999")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_MIN, TYPES.DECIMAL, decimalOption); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DECIMAL, TYPES.DECIMAL, new NumberFormatException("???DECIMAL???????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_OVER_MAX, TYPES.DECIMAL, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_UNDER_MIN, TYPES.DECIMAL, new NumberFormatException("????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_BIG_VALUE, TYPES.DECIMAL, new NumberFormatException("????")); decimalOption.modify(new BigDecimal("0")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_0, TYPES.DECIMAL, decimalOption); decimalOption.modify(new BigDecimal("1")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_1, TYPES.DECIMAL, decimalOption); decimalOption.modify(new BigDecimal("-1")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_MINUS1, TYPES.DECIMAL, decimalOption); decimalOption.modify(new BigDecimal("6.54321")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DECIMAL, TYPES.DECIMAL, decimalOption); decimalOption.modify(new BigDecimal("9223372036854775808")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_OVER_MAX, TYPES.DECIMAL, decimalOption); decimalOption.modify(new BigDecimal("-9223372036854775809")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_UNDER_MIN, TYPES.DECIMAL, decimalOption); decimalOption.modify(new BigDecimal("12345678901234567890")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_BIG_VALUE, TYPES.DECIMAL, decimalOption); decimalOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.BLANK, TYPES.DECIMAL, decimalOption); longOption.setNull(); testGetXXXOptionDo(excelUtils, sheet, DATA.NULL_STRING, TYPES.DECIMAL, new NumberFormatException("DECIMAL???????")); decimalOption.modify(new BigDecimal("1")); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_TRUE, TYPES.DECIMAL, decimalOption); decimalOption.modify(new BigDecimal("0")); testGetXXXOptionDo(excelUtils, sheet, DATA.BOOL_FALSE, TYPES.DECIMAL, decimalOption); decimalOption.modify(new BigDecimal("40179")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATE, TYPES.DECIMAL, decimalOption); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT1, TYPES.DECIMAL, new CellTypeMismatchException("DECIMAL")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATE_FMT2, TYPES.DECIMAL, new CellTypeMismatchException("DECIMAL")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT1, TYPES.DECIMAL, new CellTypeMismatchException("DECIMAL")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATE_DATETIME_FIMT2, TYPES.DECIMAL, new CellTypeMismatchException("DECIMAL")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATE, TYPES.DECIMAL, new NumberFormatException("DECIMAL???????")); testGetXXXOptionDo(excelUtils, sheet, DATA.NUMERIC_DATETIME, TYPES.DECIMAL, new NumberFormatException("???DECIMAL???????")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT1, TYPES.DECIMAL, new CellTypeMismatchException("DECIMAL")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATE_FMT2, TYPES.DECIMAL, new CellTypeMismatchException("DECIMAL")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT1, TYPES.DECIMAL, new CellTypeMismatchException("DECIMAL")); testGetXXXOptionDo(excelUtils, sheet, DATA.DATETIME_DATETIME_FIMT2, TYPES.DECIMAL, new CellTypeMismatchException("DECIMAL")); testGetXXXOptionDo(excelUtils, sheet, DATA.STRING_DATETIME, TYPES.DECIMAL, new NumberFormatException("DECIMAL???????")); testGetXXXOptionDo(excelUtils, sheet, DATA.ERROR, TYPES.DECIMAL, new CellTypeMismatchException("DECIMAL")); testGetXXXOptionDo(excelUtils, sheet, DATA.FORMULA, TYPES.DECIMAL, new CellTypeMismatchException("DECIMAL")); }