Greg Burnham - 2007-07-26

I'm working on a struts/tomcat/hibernate web app and I need to insert formulas and dates into a spreadsheet.

First, the dates:

If I use this code snippet:

    Date testDate = new Date();
    jxl.write.DateTime dob = new jxl.write.DateTime(1, row, testDate);
    sheet.addCell(dob);

The excel file gets a date of "1/0/1900" (I didn't even know there was a zeroth of January in 1900).  What am I doing wrong?

Second, formulas:

If I use this code snippet:

    Formula formula = new Formula(2, row, "=SUM(C1:C" + (row - 1) + ")");
    sheet.addCell(formula);

The "addCell" function throws a "java.util.EmptyStackException" exception.  Again, where am I going wrong?