Add support for styling

Added top level methods on the Writer:
 - addRowWithStyle()
 - addRowsWithStyle()

Added a style builder, to easily create new styles.
Each writer can specify its own default style and all styles will automatically inherit from it.

For now, the style properties supported are:
 - bold
 - italic
 - underline
 - strikethrough
 - font size
 - font name
 - wrap text (alignment)
This commit is contained in:
Adrien Loison committed 2015-08-07 20:39:17 -07:00
1 parent 0104714cbd
commit 21263a0730
14 files changed
+1344 -22

No files matched your search

+2 -6
View File
@@ -9,7 +9,7 @@ use Box\Spout\Writer\WriterFactory;
/**
* Class XLSXTest
*
* @package Box\Spout\Writer
* @package Box\Spout\Writer\XLSX
*/
class WriterTest extends \PHPUnit_Framework_TestCase
{
@@ -26,8 +26,6 @@ class WriterTest extends \PHPUnit_Framework_TestCase
$writer = WriterFactory::create(Type::XLSX);
@$writer->openToFile($filePath);
$writer->addRow(['xlsx--11', 'xlsx--12']);
$writer->close();
}
/**
@@ -37,17 +35,15 @@ class WriterTest extends \PHPUnit_Framework_TestCase
{
$writer = WriterFactory::create(Type::XLSX);
$writer->addRow(['xlsx--11', 'xlsx--12']);
$writer->close();
}
/**
* @expectedException \Box\Spout\Writer\Exception\WriterNotOpenedException
*/
public function testAddRowShouldThrowExceptionIfCallAddRowsBeforeOpeningWriter()
public function testAddRowShouldThrowExceptionIfCalledBeforeOpeningWriter()
{
$writer = WriterFactory::create(Type::XLSX);
$writer->addRows([['xlsx--11', 'xlsx--12']]);
$writer->close();
}
/**