Bug 53644 - [PATCH] XLS formula bugfix (CalFieldFunc) + WeekDay addon
Summary: [PATCH] XLS formula bugfix (CalFieldFunc) + WeekDay addon
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.9-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2012-08-02 14:37 UTC by Thies Wellpott
Modified: 2012-09-05 13:12 UTC (History)
0 users

ant-generated patch text file (15.54 KB, patch)
2012-08-02 14:37 UTC, Thies Wellpott
Details | Diff
ant-generated patch tar-gz file (1.92 KB, text/plain)
2012-08-02 14:38 UTC, Thies Wellpott
English javadoc for WeekdayFunc (1.91 KB, patch)
2012-09-05 13:12 UTC, Thies Wellpott
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thies Wellpott 2012-08-02 14:37:47 UTC
Created attachment 29155 [details]
ant-generated patch text file

Bugfixes and addons of some formula evaluations.
I used EXCEL 2010 as basis to get the excel behaviour. I used the modifications on a quite complex XLS with HSSFWorkbook only.

Changes in detail:

- FunctionEval
  + added function no. 70 (WeekdayFunc)

- WeekdayFunc
  + complete new implementation
  + tested manually for several cases (unit tests todo, sorry)

- Address
  + third parameter can be left out, support for this added

- TestAddress
  + unit test for above situation added

- BooleanFunction
  + parameters can be left out (e.g. "OR(true,,false,)", support for this added

- DateUtil
  + made some constants public because they are of general use and the class is the right place
  + added getJavaCalendar() functions that are similar to existing getJavaDate() but return a Calendar
  + getJavaDate() use the new getJavaCalendar() internally (because the originally create a Calendar and drop it)
  + commented out an "if (false)" because this is just a comment inside, so no need for dead code

- CalendarFieldFunction
  + bug fix: XLS performs rounding on sub-second level
  + bug fix: XLS HOUR() does not care about daylight saving, so use UTC timezone for getting hour
  + uses new DateUtil methods (see above)

- TestCalendarFieldFunction
  + unit tests for above fixed situations added

- eval-devguide.xml
  + some typos fixed
  + weekday mentioned

- patch.xml
  + the regexps were to generic, the generated patch for the above files included "Address.java" and "TestAdress.java" as new files because the contain a capital "A". The svn change indicator is in the first column, so added a ^ in the regexp. PLEASE, TEST THIS in different development environments, because I am not sure, if this change is generically correct or just works for me.

A side note to the POI developers:
Setup of the project is great. "svn checkout" + "ant jar" worked out of the box (for me). With this "organisational stuff" working without problems, giving back own modifications/fixes to the POI project is fun. Keep up the great work!
Comment 1 Thies Wellpott 2012-08-02 14:38:34 UTC
Created attachment 29156 [details]
ant-generated patch tar-gz file
Comment 2 Yegor Kozlov 2012-08-11 16:17:28 UTC
Thanks for the patch, applied in r1371969

small request: the javadoc for WeekdayFunc.evaluate is in German, can you translate it to English? 

Comment 3 Thies Wellpott 2012-09-05 13:12:44 UTC
Created attachment 29333 [details]
English javadoc for WeekdayFunc

Javadoc for WeekdayFunc translated to English.