aVadim483 / fast-excel-writer

Lightweight and very fast XLSX Excel Spreadsheet Writer in PHP
MIT License
178 stars 31 forks source link

Different nextRow() behaviors #98

Open SoGCuicui opened 4 days ago

SoGCuicui commented 4 days ago

Concidering the following code:

require_once __DIR__ . "/vendor/autoload.php";

$excel = avadim\FastExcelWriter\Excel::create(["Row by Row", "Direct"]);

$sheet = $excel->getSheet("Row by Row");
$sheet->writeRow(["foo", "bar"])->nextRow();
$sheet->writeRow(["foo", "bar"]);

$sheet = $excel->getSheet("Direct");
$area = $sheet->beginArea(); // "Direct" writing
$area->writeRow(["foo", "bar"])->nextRow();
$area->writeRow(["foo", "bar"]);

$excel->save(__DIR__ . "/test.xlsx");

In the first "Row by Row" tab, the two lines follow each other, making the first nextRow() call basically useless.
(Except at least for a subsequent call to $sheet->getCurrentRowId();, that then returns 1 if nextRow() is there, and 0 if not.)

In the second "Direct" tab, the two lines are separated by an empty one (as expected, I guess).

Would it be possible to have the same behavior in both cases?