Merge remote-tracking branch 'remotes/origin/master' into custom-column-widths
# Conflicts: # src/Spout/Writer/XLSX/Manager/WorksheetManager.php
This commit is contained in:
commit
49e621b822
102 files changed
+1051
-381
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
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Box\Spout\Writer\ODS;
|
||||
|
||||
use Box\Spout\Common\Entity\Row;
|
||||
use Box\Spout\Common\Entity\Style\Border;
|
||||
use Box\Spout\Common\Entity\Style\CellAlignment;
|
||||
use Box\Spout\Common\Entity\Style\Color;
|
||||
use Box\Spout\Common\Entity\Style\Style;
|
||||
use Box\Spout\Reader\Wrapper\XMLReader;
|
||||
@@ -204,6 +205,25 @@ class WriterWithStyleTest extends TestCase
|
||||
$this->assertFirstChildHasAttributeEquals('wrap', $customStyleElement, 'table-cell-properties', 'fo:wrap-option');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
public function testAddRowShouldApplyCellAlignment()
|
||||
{
|
||||
$fileName = 'test_add_row_should_apply_cell_alignment.xlsx';
|
||||
|
||||
$rightAlignedStyle = (new StyleBuilder())->setCellAlignment(CellAlignment::RIGHT)->build();
|
||||
$dataRows = $this->createStyledRowsFromValues([['ods--11']], $rightAlignedStyle);
|
||||
|
||||
$this->writeToODSFile($dataRows, $fileName);
|
||||
|
||||
$styleElements = $this->getCellStyleElementsFromContentXmlFile($fileName);
|
||||
$this->assertCount(2, $styleElements, 'There should be 2 styles (default and custom)');
|
||||
|
||||
$customStyleElement = $styleElements[1];
|
||||
$this->assertFirstChildHasAttributeEquals('end', $customStyleElement, 'paragraph-properties', 'fo:text-align');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user