@@ -162,6 +162,11 @@ ZEND_END_ARG_INFO()
162162ZEND_BEGIN_ARG_INFO_EX (xls_open_sheet_arginfo , 0 , 0 , 1 )
163163 ZEND_ARG_INFO (0 , zs_sheet_name )
164164ZEND_END_ARG_INFO ()
165+
166+ ZEND_BEGIN_ARG_INFO_EX (xls_next_cell_callback_arginfo , 0 , 0 , 2 )
167+ ZEND_ARG_INFO (0 , fci )
168+ ZEND_ARG_INFO (0 , sheet_name )
169+ ZEND_END_ARG_INFO ()
165170/* }}} */
166171
167172/** {{{ \Vtiful\Kernel\xls::__construct(array $config)
@@ -728,11 +733,13 @@ PHP_METHOD(vtiful_xls, openFile)
728733 */
729734PHP_METHOD (vtiful_xls , openSheet )
730735{
736+ zend_long zl_flag = XLSXIOREAD_SKIP_NONE ;
731737 zend_string * zs_sheet_name = NULL ;
732738
733- ZEND_PARSE_PARAMETERS_START (0 , 1 )
739+ ZEND_PARSE_PARAMETERS_START (0 , 2 )
734740 Z_PARAM_OPTIONAL
735741 Z_PARAM_STR (zs_sheet_name )
742+ Z_PARAM_LONG (zl_flag )
736743 ZEND_PARSE_PARAMETERS_END ();
737744
738745 ZVAL_COPY (return_value , getThis ()) ;
@@ -743,7 +750,7 @@ PHP_METHOD(vtiful_xls, openSheet)
743750 RETURN_NULL ();
744751 }
745752
746- obj -> read_ptr .sheet_t = sheet_open (obj -> read_ptr .file_t , zs_sheet_name );
753+ obj -> read_ptr .sheet_t = sheet_open (obj -> read_ptr .file_t , zs_sheet_name , zl_flag );
747754}
748755/* }}} */
749756
@@ -782,6 +789,35 @@ PHP_METHOD(vtiful_xls, nextRow)
782789}
783790/* }}} */
784791
792+ /** {{{ \Vtiful\Kernel\xls::nextCellCallback()
793+ */
794+ PHP_METHOD (vtiful_xls , nextCellCallback )
795+ {
796+ zend_string * zs_sheet_name = NULL ;
797+ zend_fcall_info fci = empty_fcall_info ;
798+ zend_fcall_info_cache fci_cache = empty_fcall_info_cache ;
799+
800+ ZEND_PARSE_PARAMETERS_START (1 , 2 )
801+ Z_PARAM_FUNC (fci , fci_cache )
802+ Z_PARAM_OPTIONAL
803+ Z_PARAM_STR (zs_sheet_name )
804+ ZEND_PARSE_PARAMETERS_END ();
805+
806+ xls_object * obj = Z_XLS_P (getThis ());
807+
808+ if (!obj -> read_ptr .file_t ) {
809+ RETURN_FALSE ;
810+ }
811+
812+ xls_read_callback_data callback_data ;
813+
814+ callback_data .fci = & fci ;
815+ callback_data .fci_cache = & fci_cache ;
816+
817+ load_sheet_current_row_data_callback (zs_sheet_name , obj -> read_ptr .file_t , & callback_data );
818+ }
819+ /* }}} */
820+
785821#endif
786822
787823/** {{{ xls_methods
@@ -808,10 +844,11 @@ zend_function_entry xls_methods[] = {
808844 PHP_ME (vtiful_xls , setRow , xls_set_row_arginfo , ZEND_ACC_PUBLIC )
809845
810846#ifdef ENABLE_READER
811- PHP_ME (vtiful_xls , openFile , xls_open_file_arginfo , ZEND_ACC_PUBLIC )
812- PHP_ME (vtiful_xls , openSheet , xls_open_sheet_arginfo , ZEND_ACC_PUBLIC )
813- PHP_ME (vtiful_xls , getSheetData , NULL , ZEND_ACC_PUBLIC )
814- PHP_ME (vtiful_xls , nextRow , NULL , ZEND_ACC_PUBLIC )
847+ PHP_ME (vtiful_xls , openFile , xls_open_file_arginfo , ZEND_ACC_PUBLIC )
848+ PHP_ME (vtiful_xls , openSheet , xls_open_sheet_arginfo , ZEND_ACC_PUBLIC )
849+ PHP_ME (vtiful_xls , getSheetData , NULL , ZEND_ACC_PUBLIC )
850+ PHP_ME (vtiful_xls , nextRow , NULL , ZEND_ACC_PUBLIC )
851+ PHP_ME (vtiful_xls , nextCellCallback , xls_next_cell_callback_arginfo , ZEND_ACC_PUBLIC )
815852#endif
816853
817854 PHP_FE_END
@@ -834,6 +871,12 @@ VTIFUL_STARTUP_FUNCTION(excel) {
834871 REGISTER_CLASS_PROPERTY_NULL (vtiful_xls_ce , V_XLS_COF , ZEND_ACC_PRIVATE );
835872 REGISTER_CLASS_PROPERTY_NULL (vtiful_xls_ce , V_XLS_FIL , ZEND_ACC_PRIVATE );
836873
874+ #ifdef ENABLE_READER
875+ REGISTER_CLASS_CONST_LONG (vtiful_xls_ce , V_XLS_CONST_READ_SKIP_NONE , XLSXIOREAD_SKIP_NONE );
876+ REGISTER_CLASS_CONST_LONG (vtiful_xls_ce , V_XLS_CONST_READ_SKIP_EMPTY_ROW , XLSXIOREAD_SKIP_EMPTY_ROWS );
877+ REGISTER_CLASS_CONST_LONG (vtiful_xls_ce , V_XLS_CONST_READ_SKIP_EMPTY_CELLS , XLSXIOREAD_SKIP_EMPTY_CELLS );
878+ #endif
879+
837880 REGISTER_CLASS_CONST_LONG (vtiful_xls_ce , V_XLS_CONST_READ_TYPE_INT , READ_TYPE_INT );
838881 REGISTER_CLASS_CONST_LONG (vtiful_xls_ce , V_XLS_CONST_READ_TYPE_DOUBLE , READ_TYPE_DOUBLE );
839882 REGISTER_CLASS_CONST_LONG (vtiful_xls_ce , V_XLS_CONST_READ_TYPE_STRING , READ_TYPE_STRING );
0 commit comments