aboutsummaryrefslogtreecommitdiffstats
path: root/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java
diff options
context:
space:
mode:
authorJosh Micich <josh@apache.org>2008-08-25 22:41:08 +0000
committerJosh Micich <josh@apache.org>2008-08-25 22:41:08 +0000
commit04dfa8d39f2592299829fff743621b93ff64c965 (patch)
tree881398768360c038ef30c0ab76419702ce091282 /src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java
parentd4b6c06f2b15a1aa1e9f991192e6869ca35d4f3a (diff)
downloadpoi-04dfa8d39f2592299829fff743621b93ff64c965.tar.gz
poi-04dfa8d39f2592299829fff743621b93ff64c965.zip
Replaced calls to deprecated versions of createCell(), getCell(), createRow(), and getRow(). (Changing short to int)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@688910 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java')
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java262
1 files changed, 131 insertions, 131 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java b/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java
index 3fdc1a9dba..36eaf92f32 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestFormulas.java
@@ -54,8 +54,8 @@ public final class TestFormulas extends TestCase {
HSSFCell c = null;
//get our minimum values
- r = s.createRow((short)1);
- c = r.createCell((short)1);
+ r = s.createRow(1);
+ c = r.createCell(1);
c.setCellFormula(1 + "+" + 1);
wb.write(out);
@@ -64,8 +64,8 @@ public final class TestFormulas extends TestCase {
FileInputStream in = new FileInputStream(file);
wb = new HSSFWorkbook(in);
s = wb.getSheetAt(0);
- r = s.getRow((short)1);
- c = r.getCell((short)1);
+ r = s.getRow(1);
+ c = r.getCell(1);
assertTrue("Formula is as expected",("1+1".equals(c.getCellFormula())));
in.close();
@@ -176,24 +176,24 @@ public final class TestFormulas extends TestCase {
//get our minimum values
- r = s.createRow((short)0);
- c = r.createCell((short)1);
+ r = s.createRow(0);
+ c = r.createCell(1);
c.setCellFormula(""+Float.MIN_VALUE + operator + Float.MIN_VALUE);
for (short x = 1; x < Short.MAX_VALUE && x > 0; x=(short)(x*2) ) {
- r = s.createRow((short) x);
+ r = s.createRow(x);
for (short y = 1; y < 256 && y > 0; y= (short) (y +2)) {
- c = r.createCell((short) y);
+ c = r.createCell(y);
c.setCellFormula("" + x+"."+y + operator + y +"."+x);
}
}
if (s.getLastRowNum() < Short.MAX_VALUE) {
- r = s.createRow((short)0);
- c = r.createCell((short)0);
+ r = s.createRow(0);
+ c = r.createCell(0);
c.setCellFormula("" + Float.MAX_VALUE + operator + Float.MAX_VALUE);
}
wb.write(out);
@@ -216,11 +216,11 @@ public final class TestFormulas extends TestCase {
// dont know how to check correct result .. for the moment, we just verify that the file can be read.
for (short x = 1; x < Short.MAX_VALUE && x > 0; x=(short)(x*2)) {
- r = s.getRow((short) x);
+ r = s.getRow(x);
for (short y = 1; y < 256 && y > 0; y=(short)(y+2)) {
- c = r.getCell((short) y);
+ c = r.getCell(y);
assertTrue("got a formula",c.getCellFormula()!=null);
assertTrue("loop Formula is as expected "+x+"."+y+operator+y+"."+x+"!="+c.getCellFormula(),(
@@ -337,8 +337,8 @@ public final class TestFormulas extends TestCase {
HSSFCell c = null;
//get our minimum values
- r = s.getRow((short)0);
- c = r.getCell((short)1);
+ r = s.getRow(0);
+ c = r.getCell(1);
//get our minimum values
assertTrue("minval Formula is as expected A2"+operator+"A3 != "+c.getCellFormula(),
( ("A2"+operator+"A3").equals(c.getCellFormula())
@@ -346,7 +346,7 @@ public final class TestFormulas extends TestCase {
for (short x = 1; x < Short.MAX_VALUE && x > 0; x=(short)(x*2)) {
- r = s.getRow((short) x);
+ r = s.getRow(x);
for (short y = 1; y < 256 && y > 0; y++) {
@@ -372,7 +372,7 @@ public final class TestFormulas extends TestCase {
refy2=(short)(y-3);
}
- c = r.getCell((short) y);
+ c = r.getCell(y);
CellReference cr= new CellReference(refx1, refy1, false, false);
ref=cr.formatAsString();
cr=new CellReference(refx2,refy2, false, false);
@@ -389,8 +389,8 @@ public final class TestFormulas extends TestCase {
}
//test our maximum values
- r = s.getRow((short)0);
- c = r.getCell((short)0);
+ r = s.getRow(0);
+ c = r.getCell(0);
assertTrue("maxval Formula is as expected",(
("B1"+operator+"IV255").equals(c.getCellFormula())
@@ -416,8 +416,8 @@ public final class TestFormulas extends TestCase {
HSSFCell c = null;
//get our minimum values
- r = s.createRow((short)0);
- c = r.createCell((short)1);
+ r = s.createRow(0);
+ c = r.createCell(1);
c.setCellFormula(formula);
wb.write(out);
@@ -429,8 +429,8 @@ public final class TestFormulas extends TestCase {
s = wb.getSheetAt(0);
//get our minimum values
- r = s.getRow((short)0);
- c = r.getCell((short)1);
+ r = s.getRow(0);
+ c = r.getCell(1);
assertTrue("minval Formula is as expected",
formula.equals(c.getCellFormula())
);
@@ -496,18 +496,18 @@ public final class TestFormulas extends TestCase {
HSSFCell c = null;
//get our minimum values
- r = s.getRow((short)0);
- c = r.getCell((short)1);
+ r = s.getRow(0);
+ c = r.getCell(1);
assertTrue("minval Formula is as expected 1"+operator+"1 != "+c.getCellFormula(),
( ("1"+operator+"1").equals(c.getCellFormula())
));
for (short x = 1; x < Short.MAX_VALUE && x > 0; x=(short)(x*2)) {
- r = s.getRow((short) x);
+ r = s.getRow(x);
for (short y = 1; y < 256 && y > 0; y++) {
- c = r.getCell((short) y);
+ c = r.getCell(y);
assertTrue("loop Formula is as expected "+x+operator+y+"!="+c.getCellFormula(),(
(""+x+operator+y).equals(c.getCellFormula())
@@ -519,8 +519,8 @@ public final class TestFormulas extends TestCase {
}
//test our maximum values
- r = s.getRow((short)0);
- c = r.getCell((short)0);
+ r = s.getRow(0);
+ c = r.getCell(0);
assertTrue("maxval Formula is as expected",(
@@ -549,9 +549,9 @@ public final class TestFormulas extends TestCase {
HSSFCell c = null;
- r = s.createRow((short) 0);
+ r = s.createRow(0);
- c = r.createCell((short) 0);
+ c = r.createCell(0);
c.setCellFormula(function+"(A2:A3)");
@@ -563,7 +563,7 @@ public final class TestFormulas extends TestCase {
wb = new HSSFWorkbook(in);
s = wb.getSheetAt(0);
r = s.getRow(0);
- c = r.getCell((short)0);
+ c = r.getCell(0);
assertTrue("function ="+function+"(A2:A3)",
( (function+"(A2:A3)").equals((function+"(A2:A3)")) )
@@ -586,9 +586,9 @@ public final class TestFormulas extends TestCase {
HSSFCell c = null;
- r = s.createRow((short) 0);
+ r = s.createRow(0);
- c = r.createCell((short) 0);
+ c = r.createCell(0);
c.setCellFormula(function+"(A2,A3)");
@@ -600,7 +600,7 @@ public final class TestFormulas extends TestCase {
wb = new HSSFWorkbook(in);
s = wb.getSheetAt(0);
r = s.getRow(0);
- c = r.getCell((short)0);
+ c = r.getCell(0);
assertTrue("function ="+function+"(A2,A3)",
( (function+"(A2,A3)").equals(c.getCellFormula()) )
@@ -624,11 +624,11 @@ public final class TestFormulas extends TestCase {
HSSFCell c = null;
- r = s.createRow((short) 0);
+ r = s.createRow(0);
- c = r.createCell((short) 0);
+ c = r.createCell(0);
c.setCellFormula(function+"(A2:A4,B2:B4)");
- c=r.createCell((short) 1);
+ c=r.createCell(1);
c.setCellFormula(function+"($A$2:$A4,B$2:B4)");
wb.write(out);
@@ -639,13 +639,13 @@ public final class TestFormulas extends TestCase {
wb = new HSSFWorkbook(in);
s = wb.getSheetAt(0);
r = s.getRow(0);
- c = r.getCell((short)0);
+ c = r.getCell(0);
assertTrue("function ="+function+"(A2:A4,B2:B4)",
( (function+"(A2:A4,B2:B4)").equals(c.getCellFormula()) )
);
- c=r.getCell((short) 1);
+ c=r.getCell(1);
assertTrue("function ="+function+"($A$2:$A4,B$2:B4)",
( (function+"($A$2:$A4,B$2:B4)").equals(c.getCellFormula()) )
);
@@ -663,17 +663,17 @@ public final class TestFormulas extends TestCase {
HSSFCell c = null;
- r = s.createRow((short) 0);
+ r = s.createRow(0);
- c = r.createCell((short) 0);
+ c = r.createCell(0);
c.setCellFormula("A3+A2");
- c=r.createCell( (short) 1);
+ c=r.createCell(1);
c.setCellFormula("$A3+$A2");
- c=r.createCell( (short) 2);
+ c=r.createCell(2);
c.setCellFormula("A$3+A$2");
- c=r.createCell( (short) 3);
+ c=r.createCell(3);
c.setCellFormula("$A$3+$A$2");
- c=r.createCell( (short) 4);
+ c=r.createCell(4);
c.setCellFormula("SUM($A$3,$A$2)");
wb.write(out);
@@ -684,15 +684,15 @@ public final class TestFormulas extends TestCase {
wb = new HSSFWorkbook(in);
s = wb.getSheetAt(0);
r = s.getRow(0);
- c = r.getCell((short)0);
+ c = r.getCell(0);
assertTrue("A3+A2", ("A3+A2").equals(c.getCellFormula()));
- c = r.getCell((short)1);
+ c = r.getCell(1);
assertTrue("$A3+$A2", ("$A3+$A2").equals(c.getCellFormula()));
- c = r.getCell((short)2);
+ c = r.getCell(2);
assertTrue("A$3+A$2", ("A$3+A$2").equals(c.getCellFormula()));
- c = r.getCell((short)3);
+ c = r.getCell(3);
assertTrue("$A$3+$A$2", ("$A$3+$A$2").equals(c.getCellFormula()));
- c = r.getCell((short)4);
+ c = r.getCell(4);
assertTrue("SUM($A$3,$A$2)", ("SUM($A$3,$A$2)").equals(c.getCellFormula()));
in.close();
}
@@ -706,15 +706,15 @@ public final class TestFormulas extends TestCase {
HSSFSheet s = wb.createSheet("A");
HSSFRow r = null;
HSSFCell c = null;
- r = s.createRow((short)0);
- c = r.createCell((short)0);c.setCellValue(1);
- c = r.createCell((short)1);c.setCellValue(2);
+ r = s.createRow(0);
+ c = r.createCell(0);c.setCellValue(1);
+ c = r.createCell(1);c.setCellValue(2);
s = wb.createSheet("B");
- r = s.createRow((short)0);
- c=r.createCell((short)0); c.setCellFormula("AVERAGE(A!A1:B1)");
- c=r.createCell((short)1); c.setCellFormula("A!A1+A!B1");
- c=r.createCell((short)2); c.setCellFormula("A!$A$1+A!$B1");
+ r = s.createRow(0);
+ c=r.createCell(0); c.setCellFormula("AVERAGE(A!A1:B1)");
+ c=r.createCell(1); c.setCellFormula("A!A1+A!B1");
+ c=r.createCell(2); c.setCellFormula("A!$A$1+A!$B1");
wb.write(out);
out.close();
@@ -724,9 +724,9 @@ public final class TestFormulas extends TestCase {
wb = new HSSFWorkbook(in);
s = wb.getSheet("B");
r = s.getRow(0);
- c = r.getCell((short)0);
+ c = r.getCell(0);
assertTrue("expected: AVERAGE(A!A1:B1) got: "+c.getCellFormula(), ("AVERAGE(A!A1:B1)").equals(c.getCellFormula()));
- c = r.getCell((short)1);
+ c = r.getCell(1);
assertTrue("expected: A!A1+A!B1 got: "+c.getCellFormula(), ("A!A1+A!B1").equals(c.getCellFormula()));
in.close();
}
@@ -740,29 +740,29 @@ public final class TestFormulas extends TestCase {
HSSFCell c = null;
- r = s.createRow((short) 0);
+ r = s.createRow(0);
- c = r.createCell((short) 0);
+ c = r.createCell(0);
c.setCellFormula("A3+A2");
- c=r.createCell( (short) 1);
+ c=r.createCell(1);
c.setCellFormula("AVERAGE(A3,A2)");
- c=r.createCell( (short) 2);
+ c=r.createCell(2);
c.setCellFormula("ROW(A3)");
- c=r.createCell( (short) 3);
+ c=r.createCell(3);
c.setCellFormula("AVERAGE(A2:A3)");
- c=r.createCell( (short) 4);
+ c=r.createCell(4);
c.setCellFormula("POWER(A2,A3)");
- c=r.createCell( (short) 5);
+ c=r.createCell(5);
c.setCellFormula("SIN(A2)");
- c=r.createCell( (short) 6);
+ c=r.createCell(6);
c.setCellFormula("SUM(A2:A3)");
- c=r.createCell( (short) 7);
+ c=r.createCell(7);
c.setCellFormula("SUM(A2,A3)");
- r = s.createRow((short) 1);c=r.createCell( (short) 0); c.setCellValue(2.0);
- r = s.createRow((short) 2);c=r.createCell( (short) 0); c.setCellValue(3.0);
+ r = s.createRow(1);c=r.createCell(0); c.setCellValue(2.0);
+ r = s.createRow(2);c=r.createCell(0); c.setCellValue(3.0);
wb.write(out);
out.close();
@@ -778,10 +778,10 @@ public final class TestFormulas extends TestCase {
HSSFSheet s = wb.createSheet("A");
HSSFRow r = null;
HSSFCell c = null;
- r = s.createRow((short)0);
- c=r.createCell((short)1); c.setCellFormula("UPPER(\"abc\")");
- c=r.createCell((short)2); c.setCellFormula("LOWER(\"ABC\")");
- c=r.createCell((short)3); c.setCellFormula("CONCATENATE(\" my \",\" name \")");
+ r = s.createRow(0);
+ c=r.createCell(1); c.setCellFormula("UPPER(\"abc\")");
+ c=r.createCell(2); c.setCellFormula("LOWER(\"ABC\")");
+ c=r.createCell(3); c.setCellFormula("CONCATENATE(\" my \",\" name \")");
wb.write(out);
out.close();
@@ -789,7 +789,7 @@ public final class TestFormulas extends TestCase {
wb = openSample("StringFormulas.xls");
s = wb.getSheetAt(0);
r = s.getRow(0);
- c = r.getCell((short)0);
+ c = r.getCell(0);
assertTrue("expected: UPPER(\"xyz\") got "+c.getCellFormula(), ("UPPER(\"xyz\")").equals(c.getCellFormula()));
//c = r.getCell((short)1);
//assertTrue("expected: A!A1+A!B1 got: "+c.getCellFormula(), ("A!A1+A!B1").equals(c.getCellFormula()));
@@ -807,8 +807,8 @@ public final class TestFormulas extends TestCase {
HSSFSheet s = wb.createSheet("A");
HSSFRow r = null;
HSSFCell c = null;
- r = s.createRow((short)0);
- c=r.createCell((short)1); c.setCellFormula("IF(A1<A2,B1,B2)");
+ r = s.createRow(0);
+ c=r.createCell(1); c.setCellFormula("IF(A1<A2,B1,B2)");
wb.write(out);
@@ -820,7 +820,7 @@ public final class TestFormulas extends TestCase {
wb = new HSSFWorkbook(in);
s = wb.getSheetAt(0);
r = s.getRow(0);
- c = r.getCell((short)1);
+ c = r.getCell(1);
assertEquals("Formula in cell 1 ","IF(A1<A2,B1,B2)",c.getCellFormula());
in.close();
}
@@ -835,8 +835,8 @@ public final class TestFormulas extends TestCase {
HSSFRow r = null;
HSSFCell c = null;
- r = s.createRow( (short)0 );
- c = r.createCell( (short)0 );
+ r = s.createRow(0 );
+ c = r.createCell(0 );
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy h:mm"));
@@ -847,8 +847,8 @@ public final class TestFormulas extends TestCase {
// HSSFDateUtil.getJavaDate(excelDate).getTime());
for (int k=1; k < 100; k++) {
- r=s.createRow((short)k);
- c=r.createCell((short)0);
+ r=s.createRow(k);
+ c=r.createCell(0);
c.setCellFormula("A"+(k)+"+1");
c.setCellStyle(cellStyle);
}
@@ -870,11 +870,11 @@ public final class TestFormulas extends TestCase {
HSSFSheet s = wb.createSheet("testSheet1");
HSSFRow r = null;
HSSFCell c = null;
- r = s.createRow((short)0);
- c=r.createCell((short)1); c.setCellValue(1);
- c=r.createCell((short)2); c.setCellValue(2);
- c=r.createCell((short)3); c.setCellFormula("MAX(A1:B1)");
- c=r.createCell((short)4); c.setCellFormula("IF(A1=D1,\"A1\",\"B1\")");
+ r = s.createRow(0);
+ c=r.createCell(1); c.setCellValue(1);
+ c=r.createCell(2); c.setCellValue(2);
+ c=r.createCell(3); c.setCellFormula("MAX(A1:B1)");
+ c=r.createCell(4); c.setCellFormula("IF(A1=D1,\"A1\",\"B1\")");
wb.write(out);
out.close();
@@ -885,7 +885,7 @@ public final class TestFormulas extends TestCase {
wb = new HSSFWorkbook(in);
s = wb.getSheetAt(0);
r = s.getRow(0);
- c = r.getCell((short)4);
+ c = r.getCell(4);
assertTrue("expected: IF(A1=D1,\"A1\",\"B1\") got "+c.getCellFormula(), ("IF(A1=D1,\"A1\",\"B1\")").equals(c.getCellFormula()));
in.close();
@@ -893,7 +893,7 @@ public final class TestFormulas extends TestCase {
wb = openSample("IfFormulaTest.xls");
s = wb.getSheetAt(0);
r = s.getRow(3);
- c = r.getCell((short)0);
+ c = r.getCell(0);
assertTrue("expected: IF(A3=A1,\"A1\",\"A2\") got "+c.getCellFormula(), ("IF(A3=A1,\"A1\",\"A2\")").equals(c.getCellFormula()));
//c = r.getCell((short)1);
//assertTrue("expected: A!A1+A!B1 got: "+c.getCellFormula(), ("A!A1+A!B1").equals(c.getCellFormula()));
@@ -905,8 +905,8 @@ public final class TestFormulas extends TestCase {
s = wb.createSheet("testSheet1");
r = null;
c = null;
- r = s.createRow((short)0);
- c=r.createCell((short)0); c.setCellFormula("IF(1=1,0,1)");
+ r = s.createRow(0);
+ c=r.createCell(0); c.setCellFormula("IF(1=1,0,1)");
wb.write(out);
out.close();
@@ -920,21 +920,21 @@ public final class TestFormulas extends TestCase {
s = wb.createSheet("testSheet1");
r = null;
c = null;
- r = s.createRow((short)0);
- c=r.createCell((short)0);
+ r = s.createRow(0);
+ c=r.createCell(0);
c.setCellValue(1);
- c=r.createCell((short)1);
+ c=r.createCell(1);
c.setCellValue(3);
- HSSFCell formulaCell=r.createCell((short)3);
+ HSSFCell formulaCell=r.createCell(3);
- r = s.createRow((short)1);
- c=r.createCell((short)0);
+ r = s.createRow(1);
+ c=r.createCell(0);
c.setCellValue(3);
- c=r.createCell((short)1);
+ c=r.createCell(1);
c.setCellValue(7);
formulaCell.setCellFormula("IF(A1=B1,AVERAGE(A1:B1),AVERAGE(A2:B2))");
@@ -956,7 +956,7 @@ public final class TestFormulas extends TestCase {
HSSFSheet s = wb.getSheetAt(0);
HSSFRow r = s.getRow(0);
- HSSFCell c = r.getCell((short)2);
+ HSSFCell c = r.getCell(2);
assertEquals(function, c.getCellFormula());
@@ -965,29 +965,29 @@ public final class TestFormulas extends TestCase {
wb = new HSSFWorkbook();
s = wb.createSheet();
- r = s.createRow((short)0);
- c=r.createCell((short)0); c.setCellValue((double)1000);
- c=r.createCell((short)1); c.setCellValue((double)1);
+ r = s.createRow(0);
+ c=r.createCell(0); c.setCellValue((double)1000);
+ c=r.createCell(1); c.setCellValue((double)1);
- r = s.createRow((short)1);
- c=r.createCell((short)0); c.setCellValue((double)2000);
- c=r.createCell((short)1); c.setCellValue((double)2);
+ r = s.createRow(1);
+ c=r.createCell(0); c.setCellValue((double)2000);
+ c=r.createCell(1); c.setCellValue((double)2);
- r = s.createRow((short)2);
- c=r.createCell((short)0); c.setCellValue((double)3000);
- c=r.createCell((short)1); c.setCellValue((double)3);
+ r = s.createRow(2);
+ c=r.createCell(0); c.setCellValue((double)3000);
+ c=r.createCell(1); c.setCellValue((double)3);
- r = s.createRow((short)3);
- c=r.createCell((short)0); c.setCellValue((double)4000);
- c=r.createCell((short)1); c.setCellValue((double)4);
+ r = s.createRow(3);
+ c=r.createCell(0); c.setCellValue((double)4000);
+ c=r.createCell(1); c.setCellValue((double)4);
- r = s.createRow((short)4);
- c=r.createCell((short)0); c.setCellValue((double)5000);
- c=r.createCell((short)1); c.setCellValue((double)5);
+ r = s.createRow(4);
+ c=r.createCell(0); c.setCellValue((double)5000);
+ c=r.createCell(1); c.setCellValue((double)5);
r = s.getRow(0);
- c=r.createCell((short)2); c.setCellFormula(function);
+ c=r.createCell(2); c.setCellFormula(function);
wb.write(out);
out.close();
@@ -1002,42 +1002,42 @@ public final class TestFormulas extends TestCase {
HSSFSheet s0 = w.getSheetAt(0);
HSSFRow[] r = {s0.getRow(0), s0.getRow(1)};
- HSSFCell a1 = r[0].getCell((short) 0);
+ HSSFCell a1 = r[0].getCell(0);
assertEquals("square(1)", a1.getCellFormula());
assertEquals(1d, a1.getNumericCellValue(), 1e-9);
- HSSFCell a2 = r[1].getCell((short) 0);
+ HSSFCell a2 = r[1].getCell(0);
assertEquals("square(2)", a2.getCellFormula());
assertEquals(4d, a2.getNumericCellValue(), 1e-9);
- HSSFCell b1 = r[0].getCell((short) 1);
+ HSSFCell b1 = r[0].getCell(1);
assertEquals("IF(TRUE,square(1))", b1.getCellFormula());
assertEquals(1d, b1.getNumericCellValue(), 1e-9);
- HSSFCell b2 = r[1].getCell((short) 1);
+ HSSFCell b2 = r[1].getCell(1);
assertEquals("IF(TRUE,square(2))", b2.getCellFormula());
assertEquals(4d, b2.getNumericCellValue(), 1e-9);
- HSSFCell c1 = r[0].getCell((short) 2);
+ HSSFCell c1 = r[0].getCell(2);
assertEquals("square(square(1))", c1.getCellFormula());
assertEquals(1d, c1.getNumericCellValue(), 1e-9);
- HSSFCell c2 = r[1].getCell((short) 2);
+ HSSFCell c2 = r[1].getCell(2);
assertEquals("square(square(2))", c2.getCellFormula());
assertEquals(16d, c2.getNumericCellValue(), 1e-9);
- HSSFCell d1 = r[0].getCell((short) 3);
+ HSSFCell d1 = r[0].getCell(3);
assertEquals("square(one())", d1.getCellFormula());
assertEquals(1d, d1.getNumericCellValue(), 1e-9);
- HSSFCell d2 = r[1].getCell((short) 3);
+ HSSFCell d2 = r[1].getCell(3);
assertEquals("square(two())", d2.getCellFormula());
assertEquals(4d, d2.getNumericCellValue(), 1e-9);
}
public void testStringFormulaRead() {
HSSFWorkbook w = openSample("StringFormulas.xls");
- HSSFCell c = w.getSheetAt(0).getRow(0).getCell((short)0);
+ HSSFCell c = w.getSheetAt(0).getRow(0).getCell(0);
assertEquals("String Cell value","XYZ",c.getRichStringCellValue().getString());
}
@@ -1046,8 +1046,8 @@ public final class TestFormulas extends TestCase {
HSSFWorkbook sb = new HSSFWorkbook();
HSSFSheet s1 = sb.createSheet("Sheet a.1");
HSSFSheet s2 = sb.createSheet("Sheet.A");
- s2.createRow(1).createCell((short) 2).setCellFormula("'Sheet a.1'!A1");
- s1.createRow(1).createCell((short) 2).setCellFormula("'Sheet.A'!A1");
+ s2.createRow(1).createCell(2).setCellFormula("'Sheet a.1'!A1");
+ s1.createRow(1).createCell(2).setCellFormula("'Sheet.A'!A1");
File file = TempFile.createTempFile("testComplexSheetRefs",".xls");
sb.write(new FileOutputStream(file));
}
@@ -1073,17 +1073,17 @@ public final class TestFormulas extends TestCase {
/* MissingArgPtg */
public void testMissingArgPtg() throws Exception {
HSSFWorkbook wb = new HSSFWorkbook();
- HSSFCell cell = wb.createSheet("Sheet1").createRow(4).createCell((short) 0);
+ HSSFCell cell = wb.createSheet("Sheet1").createRow(4).createCell(0);
cell.setCellFormula("IF(A1=\"A\",1,)");
}
public void testSharedFormula() {
HSSFWorkbook wb = openSample("SharedFormulaTest.xls");
- assertEquals("A$1*2", wb.getSheetAt(0).getRow(1).getCell((short)1).toString());
- assertEquals("$A11*2", wb.getSheetAt(0).getRow(11).getCell((short)1).toString());
- assertEquals("DZ2*2", wb.getSheetAt(0).getRow(1).getCell((short)128).toString());
- assertEquals("B32770*2", wb.getSheetAt(0).getRow(32768).getCell((short)1).toString());
+ assertEquals("A$1*2", wb.getSheetAt(0).getRow(1).getCell(1).toString());
+ assertEquals("$A11*2", wb.getSheetAt(0).getRow(11).getCell(1).toString());
+ assertEquals("DZ2*2", wb.getSheetAt(0).getRow(1).getCell(128).toString());
+ assertEquals("B32770*2", wb.getSheetAt(0).getRow(32768).getCell(1).toString());
}
public static void main(String [] args) {