killmenow

This commit is contained in:
willkensonh 2018-10-15 14:19:31 +11:00
parent bca69a7fcd
commit 7a73f5b2cd
2 changed files with 18 additions and 2 deletions

View File

@ -14,7 +14,7 @@ class OptionsManager extends OptionsManagerAbstract
{ {
/** Default style font values */ /** Default style font values */
const DEFAULT_FONT_SIZE = 12; const DEFAULT_FONT_SIZE = 12;
const DEFAULT_FONT_NAME = 'Calibri'; const DEFAULT_FONT_NAME = 'Arial';
/** @var StyleBuilder Style builder */ /** @var StyleBuilder Style builder */
protected $styleBuilder; protected $styleBuilder;

View File

@ -225,7 +225,7 @@ EOD;
$styleId = $style->getId(); $styleId = $style->getId();
$fillId = $this->getFillIdForStyleId($styleId); $fillId = $this->getFillIdForStyleId($styleId);
$borderId = $this->getBorderIdForStyleId($styleId); $borderId = $this->getBorderIdForStyleId($styleId);
$numberFormatId = !empty($style->getNumberFormat()) ? $style->getNumberFormat()->getId() : 0; $numberFormatId = $this->getNumberFormatIdForStyleId($styleId);
$content .= '<xf numFmtId="'.$numberFormatId.'" fontId="' . $styleId . '" fillId="' . $fillId . '" borderId="' . $borderId . '" xfId="0"'; $content .= '<xf numFmtId="'.$numberFormatId.'" fontId="' . $styleId . '" fillId="' . $fillId . '" borderId="' . $borderId . '" xfId="0"';
@ -282,6 +282,22 @@ EOD;
return $isDefaultStyle ? 0 : ($this->styleRegistry->getBorderIdForStyleId($styleId) ?: 0); return $isDefaultStyle ? 0 : ($this->styleRegistry->getBorderIdForStyleId($styleId) ?: 0);
} }
/**
* Returns the fill ID associated to the given style ID.
* For the default style, we don't a border.
*
* @param int $styleId
* @return int
*/
private function getNumberFormatIdForStyleId($styleId)
{
// For the default style (ID = 0), we don't want to override the border.
// Otherwise all cells of the spreadsheet will have a border.
$isDefaultStyle = ($styleId === 0);
return $isDefaultStyle ? 0 : ($this->styleRegistry->getNumberFormatIdForStyleId($styleId) ?: 0);
}
/** /**
* Returns the content of the "<cellStyles>" section. * Returns the content of the "<cellStyles>" section.
* *