Add support for cells in error when writing XLSX and ODS
When appending data to an existing sheet, it was possible to get cells in error when reading (DIV/0 for instance). When trying to write them back, `addRow` would throw because `Cell`s in error were not supported by the writers.
This commit is contained in:
1 parent
eb88bb4c3a
commit
7964dadc21
5 files changed
+53
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\XLSX;
|
||||
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Exception\InvalidArgumentException;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
@@ -375,6 +376,23 @@ class WriterTest extends TestCase
|
||||
$this->assertInlineDataWasWrittenToSheet($fileName, 1, 10.2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testAddRowShouldSupportCellInError()
|
||||
{
|
||||
$fileName = 'test_add_row_should_support_cell_in_error.xlsx';
|
||||
|
||||
$cell = WriterEntityFactory::createCell('#DIV/0');
|
||||
$cell->setType(Cell::TYPE_ERROR);
|
||||
|
||||
$row = WriterEntityFactory::createRow([$cell]);
|
||||
|
||||
$this->writeToXLSXFile([$row], $fileName);
|
||||
|
||||
$this->assertInlineDataWasWrittenToSheet($fileName, 1, 't="e"><v>#DIV/0</v>');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user