kasparsd / mini-sheets-php

Library for creating the most basic Office Open XML and Excel XLSX files.
https://kaspars.net/blog/excel-xlsx-xml-php
MIT License
11 stars 0 forks source link

Garbled output when two Xlsx files are build one after another. #2

Open albeda1 opened 3 years ago

albeda1 commented 3 years ago

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....