Pārlūkot izejas kodu

Merge pull request #290 from viest/dev

Fix: header line no and sheet checkout not init line no
viest 4 gadi atpakaļ
vecāks
revīzija
12987f4de9
2 mainītis faili ar 11 papildinājumiem un 2 dzēšanām
  1. 1 1
      kernel/common.c
  2. 10 1
      kernel/excel.c

+ 1 - 1
kernel/common.c

@@ -57,7 +57,7 @@ void call_object_method(zval *object, const char *function_name, uint32_t param_
     zval z_f_name;
 
     ZVAL_STRINGL(&z_f_name, function_name, strlen(function_name));
-    call_user_function_ex(NULL, object, &z_f_name, ret_val, param_count, params, 0, NULL);
+    call_user_function(NULL, object, &z_f_name, ret_val, param_count, params);
 
     if (Z_ISUNDEF_P(ret_val)) {
         ZVAL_NULL(ret_val);

+ 10 - 1
kernel/excel.c

@@ -377,6 +377,11 @@ PHP_METHOD(vtiful_xls, checkoutSheet)
 
     line = sheet_t->table->cached_row_num + 1;
 
+    // sheet not insert data
+    if (sheet_t->table->cached_row_num > LXW_ROW_MAX) {
+        line = 0;
+    }
+
     SHEET_LINE_SET(obj, line);
 
     obj->write_ptr.worksheet = sheet_t;
@@ -479,7 +484,11 @@ PHP_METHOD(vtiful_xls, header)
          type_writer(header_value, 0, header_l_key, &obj->write_ptr, NULL, format_handle);
     ZEND_HASH_FOREACH_END();
 
-    SHEET_LINE_ADD(obj)
+    // When inserting the header for the first time, the row number is incremented by one,
+    // and there is no need to increment by one again for subsequent calls.
+    if (obj->write_line == 0) {
+        SHEET_LINE_ADD(obj)
+    }
 }
 /* }}} */