Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insertText() with format value of empty string changes the dates to show as numbers #527

Closed
tdclaritum opened this issue Sep 19, 2024 · 1 comment · Fixed by #536
Closed

Comments

@tdclaritum
Copy link

If $excel->insertText() is called with format param set to empty string it will change the formatting of the date columns and they are displayed as numbers. It doesn't matter if $excel->insertDate() will insert the date to the same column or different. The date always shows as a number

Code to reproduce

<?php
require_once "vendor/autoload.php";

$excel = new \Vtiful\Kernel\Excel(['path' => __DIR__ . '/data/cache/']);

$dateFile = $excel->fileName("free.xlsx")
    ->header(['date']);

$excel->insertText(1, 0, "1", '');
$dateFile->insertDate(2, 0, time(), 'yyyy-mm-dd hh:mm:ss');


$dateFile->output();

Expected result

date
1
2024-09-19 10:34:47

Actual Result

date
1
45554.43352

Details and versions

xlswriter support => enabled
Version => 1.5.7
bundled libxlsxwriter version => 1.1.3
bundled libxlsxio version => 0.2.27
PHP 8.2.23 (cli) (built: Sep  7 2024 01:30:11) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.23, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.23, Copyright (c), by Zend Technologies
    with Xdebug v3.3.2, Copyright (c) 2002-2024, by Derick Rethans
@DAdq26
Copy link

DAdq26 commented Dec 12, 2024

Hi
The issue is still active with php 8.3 and xlswriter 1.5.8 release..
On my own

image

image

Code to reproduce

image

Any fix on your side?

Best

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@tdclaritum @DAdq26 and others