Set wrap text style when multiline string encountered

Fixes #10
If a cell contains a multiline string, "wrap text" style option should
automatically be set.
This commit is contained in:
Adrien Loison committed 2015-08-13 23:03:28 -07:00
1 parent 1c8934790d
commit c8ddcf5441
6 files changed
+102 -8

No files matched your search

+4 -7
View File
@@ -44,11 +44,6 @@ class Workbook
/** @var Worksheet The worksheet where data will be written to */
protected $currentWorksheet;
protected $styles = [];
/**
* @param string $tempFolder
* @param bool $shouldUseInlineStrings
@@ -192,13 +187,15 @@ class Workbook
if ($this->shouldCreateNewSheetsAutomatically) {
$currentWorksheet = $this->addNewSheetAndMakeItCurrent();
$registeredStyle = $this->styleHelper->registerStyle($style);
$updatedStyle = $this->styleHelper->applyExtraStylesIfNeeded($style, $dataRow);
$registeredStyle = $this->styleHelper->registerStyle($updatedStyle);
$currentWorksheet->addRow($dataRow, $registeredStyle);
} else {
// otherwise, do nothing as the data won't be read anyways
}
} else {
$registeredStyle = $this->styleHelper->registerStyle($style);
$updatedStyle = $this->styleHelper->applyExtraStylesIfNeeded($style, $dataRow);
$registeredStyle = $this->styleHelper->registerStyle($updatedStyle);
$currentWorksheet->addRow($dataRow, $registeredStyle);
}
}