Skip to content

Commit 63517a4

Browse files
committed
* Added ExcelBook::IsDate1904/ExcelBook::ISetDate1904 methods to set/retrieve base date format
* Allow compilation against LibXL 3.5.3
1 parent 5732b29 commit 63517a4

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

ChangeLog

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
[2013-11-18] - Version 0.9.9
2+
* Added ExcelBook::IsDate1904/ExcelBook::ISetDate1904 methods to set/retrieve base date format
3+
* Allow compilation against LibXL 3.5.3
4+
* Fixed bug with parameter order inside setNamedRange method (jacksonja)
5+
16
[2012-12-31] - Version 0.9.8
27
* Allow compilation against LibXL 3.4
38
* Updated addPictureScaled() and addPictureDim() to support optional x/y offset parameters

excel.c

+55-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ enum libXLPictureType {PICTURETYPE_PNG, PICTURETYPE_JPEG, PICTURETYPE_WMF, PICTU
6161
#define PHP_EXCEL_FORMULA 2
6262
#define PHP_EXCEL_NUMERIC_STRING 3
6363

64-
#define PHP_EXCEL_VERSION "0.9.8"
64+
#define PHP_EXCEL_VERSION "0.9.9"
6565

6666
#ifdef COMPILE_DL_EXCEL
6767
ZEND_GET_MODULE(excel)
@@ -1016,6 +1016,45 @@ EXCEL_METHOD(Book, unpackDate)
10161016
}
10171017
/* }}} */
10181018

1019+
#if LIBXL_VERSION >= 0x03050300
1020+
/* {{{ proto bool ExcelBook::isDate1904()
1021+
Returns whether the 1904 date system is active: true - 1904 date system, false - 1900 date system */
1022+
EXCEL_METHOD(Book, isDate1904)
1023+
{
1024+
BookHandle book;
1025+
zval *object = getThis();
1026+
1027+
if (ZEND_NUM_ARGS()) {
1028+
RETURN_FALSE;
1029+
}
1030+
1031+
BOOK_FROM_OBJECT(book, object);
1032+
1033+
RETURN_BOOL(xlBookIsDate1904(book));
1034+
}
1035+
/* }}} */
1036+
1037+
/* {{{ proto bool ExcelBook::setDate1904(bool date_type)
1038+
Sets the date system mode: true - 1904 date system, false - 1900 date system (default) */
1039+
EXCEL_METHOD(Book, setDate1904)
1040+
{
1041+
BookHandle book;
1042+
zval *object = getThis();
1043+
zend_bool date_type;
1044+
1045+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "b", &date_type) == FAILURE) {
1046+
RETURN_FALSE;
1047+
}
1048+
1049+
BOOK_FROM_OBJECT(book, object);
1050+
1051+
xlBookSetDate1904(book, (int)date_type);
1052+
1053+
RETURN_TRUE;
1054+
}
1055+
/* }}} */
1056+
#endif
1057+
10191058
/* {{{ proto int ExcelBook::getActiveSheet()
10201059
Get the active sheet inside a file. */
10211060
EXCEL_METHOD(Book, getActiveSheet)
@@ -4047,6 +4086,17 @@ PHP_EXCEL_ARGINFO
40474086
ZEND_BEGIN_ARG_INFO_EX(arginfo_Book_getDefaultFont, 0, 0, 0)
40484087
ZEND_END_ARG_INFO()
40494088

4089+
#if LIBXL_VERSION >= 0x03050300
4090+
PHP_EXCEL_ARGINFO
4091+
ZEND_BEGIN_ARG_INFO_EX(arginfo_Book_isDate1904, 0, 0, 0)
4092+
ZEND_END_ARG_INFO()
4093+
4094+
PHP_EXCEL_ARGINFO
4095+
ZEND_BEGIN_ARG_INFO_EX(arginfo_Book_setDate1904, 0, 0, 1)
4096+
ZEND_ARG_INFO(0, date_type)
4097+
ZEND_END_ARG_INFO()
4098+
#endif
4099+
40504100
PHP_EXCEL_ARGINFO
40514101
ZEND_BEGIN_ARG_INFO_EX(arginfo_Book_setDefaultFont, 0, 0, 2)
40524102
ZEND_ARG_INFO(0, font)
@@ -4897,6 +4947,10 @@ zend_function_entry excel_funcs_book[] = {
48974947
EXCEL_ME(Book, setRGBMode, arginfo_Book_setRGBMode, 0)
48984948
EXCEL_ME(Book, colorPack, arginfo_Book_colorPack, 0)
48994949
EXCEL_ME(Book, colorUnpack, arginfo_Book_colorUnpack, 0)
4950+
#endif
4951+
#if LIBXL_VERSION >= 0x03050300
4952+
EXCEL_ME(Book, isDate1904, arginfo_Book_isDate1904, 0)
4953+
EXCEL_ME(Book, setDate1904, arginfo_Book_setDate1904, 0)
49004954
#endif
49014955
EXCEL_ME(Book, __construct, arginfo_Book___construct, 0)
49024956
#if LIBXL_VERSION >= 0x03020000

0 commit comments

Comments
 (0)