Skip to content

Commit 5a00d9f

Browse files
authored
Merge branch 'master' into dev
2 parents 3277175 + 8fcc501 commit 5a00d9f

File tree

6 files changed

+83
-16
lines changed

6 files changed

+83
-16
lines changed

kernel/excel.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,8 @@ PHP_METHOD(vtiful_xls, header)
627627
*/
628628
PHP_METHOD(vtiful_xls, data)
629629
{
630-
zend_ulong column_index = 0;
630+
zend_ulong column_index = 0, index;
631+
zend_string *key;
631632
zval *data = NULL, *data_r_value = NULL;
632633

633634
ZEND_PARSE_PARAMETERS_START(1, 1)
@@ -651,17 +652,16 @@ PHP_METHOD(vtiful_xls, data)
651652

652653
column_index = 0;
653654

654-
ZEND_HASH_FOREACH_BUCKET(Z_ARRVAL_P(data_r_value), Bucket *bucket)
655+
ZEND_HASH_FOREACH_KEY_VAL_IND(Z_ARRVAL_P(data_r_value), index, key, data) {
655656
// numeric index rewriting
656-
if (bucket->key == NULL) {
657-
column_index = bucket->h;
657+
if (key == NULL) {
658+
column_index = index;
658659
}
659-
660-
type_writer(&bucket->val, SHEET_CURRENT_LINE(obj), column_index, &obj->write_ptr, NULL, obj->format_ptr.format);
660+
type_writer(data, SHEET_CURRENT_LINE(obj), column_index, &obj->write_ptr, NULL, obj->format_ptr.format);
661661

662662
// next number index
663663
++column_index;
664-
ZEND_HASH_FOREACH_END();
664+
} ZEND_HASH_FOREACH_END();
665665

666666
SHEET_LINE_ADD(obj)
667667
ZEND_HASH_FOREACH_END();

kernel/write.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,13 @@ void set_row(zend_string *range, double height, xls_resource_write_t *res, lxw_f
355355
*/
356356
void validation(xls_resource_write_t *res, zend_string *range, lxw_data_validation *validation)
357357
{
358-
worksheet_data_validation_cell(res->worksheet, CELL(ZSTR_VAL(range)), validation);
358+
char *rangeStr = ZSTR_VAL(range);
359+
360+
if (strchr(rangeStr, ':')) {
361+
worksheet_data_validation_range(res->worksheet, RANGE(rangeStr), validation);
362+
} else {
363+
worksheet_data_validation_cell(res->worksheet, CELL(rangeStr), validation);
364+
}
359365
}
360366

361367
/*

package.xml

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,20 @@
3333
<email>[email protected]</email>
3434
<active>yes</active>
3535
</lead>
36-
<date>2021-10-07</date>
37-
<time>11:00:00</time>
36+
<date>2021-05-01</date>
37+
<time>00:00:00</time>
3838
<version>
39-
<release>1.5.0</release>
40-
<api>1.5.0</api>
39+
<release>1.5.2</release>
40+
<api>1.5.2</api>
4141
</version>
4242
<stability>
4343
<release>stable</release>
4444
<api>stable</api>
4545
</stability>
4646
<license uri="https://github.com/viest/php-ext-excel-export/blob/master/LICENSE">BSD license</license>
4747
<notes>
48-
- Feat set current line.
49-
- Feat get current line.
50-
- Feat rich string.
48+
- Fix: Write failure on data reference.
49+
- Fix: String is not zero-terminatedpage.
5150
</notes>
5251
<contents>
5352
<dir name="/">
@@ -206,6 +205,8 @@
206205
<file md5sum="9badb50b14bd81536bafcfefcb5677d6" name="tests/column_index_from_string.phpt" role="test" />
207206
<file md5sum="" name="tests/const_memory.phpt" role="test" />
208207
<file md5sum="da803170bdbbdc8191123889c187d9fa" name="tests/const_memory_index_out_range.phpt" role="test" />
208+
<file md5sum="" name="tests/data_reference.phpt" role="test" />
209+
<file md5sum="" name="tests/data_string_key.phpt" role="test" />
209210
<file md5sum="64c92ab74560df6044f1a9019458a5b4" name="tests/default_format.phpt" role="test" />
210211
<file md5sum="8c30c3f3d54a0b52a26f187c7334a020" name="tests/exist_sheet.phpt" role="test" />
211212
<file md5sum="84ef50a4df8d5ce312246676a4c933fa" name="tests/first.phpt" role="test" />
@@ -310,6 +311,40 @@
310311
<configureoption default="yes" name="enable-reader" prompt="enable reader supports?" />
311312
</extsrcrelease>
312313
<changelog>
314+
<release>
315+
<date>2021-10-27</date>
316+
<time>00:00:00</time>
317+
<version>
318+
<release>1.5.1</release>
319+
<api>1.5.1</api>
320+
</version>
321+
<stability>
322+
<release>stable</release>
323+
<api>stable</api>
324+
</stability>
325+
<license uri="https://github.com/viest/php-ext-excel-export/blob/master/LICENSE">BSD license</license>
326+
<notes>
327+
- Feat customize to enable or disable zip64.
328+
</notes>
329+
</release>
330+
<release>
331+
<date>2021-10-07</date>
332+
<time>11:00:00</time>
333+
<version>
334+
<release>1.5.0</release>
335+
<api>1.5.0</api>
336+
</version>
337+
<stability>
338+
<release>stable</release>
339+
<api>stable</api>
340+
</stability>
341+
<license uri="https://github.com/viest/php-ext-excel-export/blob/master/LICENSE">BSD license</license>
342+
<notes>
343+
- Feat set current line.
344+
- Feat get current line.
345+
- Feat rich string.
346+
</notes>
347+
</release>
313348
<release>
314349
<date>2021-07-18</date>
315350
<time>06:11:08</time>

php_xlswriter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
extern zend_module_entry xlswriter_module_entry;
1919
#define phpext_xlswriter_ptr &xlswriter_module_entry
2020

21-
#define PHP_XLSWRITER_VERSION "1.5.0"
21+
#define PHP_XLSWRITER_VERSION "1.5.2"
2222
#define PHP_XLSWRITER_AUTHOR "Jiexing.Wang ([email protected])"
2323

2424
#ifdef PHP_WIN32

tests/timestamp_from_date_double.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Check for vtiful presence
44
<?php if (!extension_loaded("xlswriter")) print "skip"; ?>
55
--FILE--
66
<?php
7+
ini_set('date.timezone', 'UTC');
78
var_dump(\Vtiful\Kernel\Excel::timestampFromDateDouble(43727.306782407));
89
var_dump(\Vtiful\Kernel\Excel::timestampFromDateDouble(NULL));
910
var_dump(\Vtiful\Kernel\Excel::timestampFromDateDouble(43727));
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
Check for vtiful presence
3+
--SKIPIF--
4+
<?php if (!extension_loaded("xlswriter")) print "skip"; ?>
5+
--FILE--
6+
<?php
7+
$config = ['path' => './tests'];
8+
9+
$validation = new \Vtiful\Kernel\Validation();
10+
$validation->validationType(\Vtiful\Kernel\Validation::TYPE_LIST)
11+
->valueList(['wjx', 'viest']);
12+
13+
$excel = new \Vtiful\Kernel\Excel($config);
14+
$filePath = $excel->fileName('tutorial.xlsx')
15+
->validation('A1', $validation->toResource())
16+
->validation('B1:B1048576', $validation->toResource())
17+
->output();
18+
19+
var_dump($validation, $filePath);
20+
?>
21+
--EXPECT--
22+
object(Vtiful\Kernel\Validation)#1 (0) {
23+
}
24+
string(21) "./tests/tutorial.xlsx"
25+

0 commit comments

Comments
 (0)