kasparsd / mini-sheets-php Goto Github PK
View Code? Open in Web Editor NEWLibrary for creating the most basic Office Open XML and Excel XLSX files.
Home Page: https://kaspars.net/blog/excel-xlsx-xml-php
License: MIT License
Library for creating the most basic Office Open XML and Excel XLSX files.
Home Page: https://kaspars.net/blog/excel-xlsx-xml-php
License: MIT License
Currently, numerical values cannot be stored in columns. The reason is that numbers incorrectly end up in "shared strings" and their indexes are ending up in the cell - not the values itself.
change this
mini-sheets-php/src/XlsxBuilder.php
Lines 78 to 83 in 16e2839
into that
$cells[] = sprintf(
'<c r="%s" t="%s"><v>%s</v></c>',
$this->escape_xml( $this->xlsx_cell_name( $row_no, $col_no ) ),
$this->escape_xml( $field_type ),
$this->escape_xml( $field_type === 'n' ? $field_value : $field_value_no )
);
Put the creation of $field_value_no
into an else
clause.
To reproduce the issue, try to generate two xlsx files, like :
$zipper1 = new \ZipArchive;
$file1 = DIR . '/file1.xlsx';
$zipper1->open( $file1, \ZipArchive::CREATE | \ZipArchive::OVERWRITE );
$builder1 = new XlsxBuilder( $zipper1 );
$builder1->add_rows( $FirstDataArray );
$builder1->build();
$zipper1->close();
(tried here to unset $builder and $zipper, but with no success)
$zipper2 = new \ZipArchive;
$file2 = DIR . '/file2.xlsx';
$zipper2->open( $file2, \ZipArchive::CREATE | \ZipArchive::OVERWRITE );
$builder2 = new XlsxBuilder( $zipper2 );
$builder2->add_rows( $SecondDataArray );
$builder2->build();
$zipper2->close();
Both files are generated. First file is ok.. second, it's garbled.
With the same code, If the first block is commented, second file become perfect.
I cannot find the leak....
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.