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
b6239546f0
5 files changed
+53
No files matched your search
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace Box\Spout\Writer\ODS;
|
||||
|
||||
use Box\Spout\Common\Entity\Cell;
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Exception\InvalidArgumentException;
|
||||
use Box\Spout\Common\Exception\IOException;
|
||||
@@ -321,6 +322,24 @@ class WriterTest extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testAddRowShouldSupportCellInError()
|
||||
{
|
||||
$fileName = 'test_add_row_should_support_cell_in_error.ods';
|
||||
|
||||
$cell = WriterEntityFactory::createCell('#DIV/0');
|
||||
$cell->setType(Cell::TYPE_ERROR);
|
||||
|
||||
$row = WriterEntityFactory::createRow([$cell]);
|
||||
|
||||
$this->writeToODSFile([$row], $fileName);
|
||||
|
||||
$this->assertValueWasWritten($fileName, 'calcext:value-type="error"');
|
||||
$this->assertValueWasWritten($fileName, '<text:p>#DIV/0</text:p>');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user