aVadim483 / fast-excel-writer

Lightweight and very fast XLSX Excel Spreadsheet Writer in PHP
MIT License
177 stars 31 forks source link

Font name gets overwritten when setting bold font style #93

Open cymn14 opened 4 weeks ago

cymn14 commented 4 weeks ago

When setting the font name globally, and then set a bold font style for the header row as an example, the font name is "reset" and has to be set again.

here's my code where that happens:

$excel = Excel::create([$this->sheetName])->setDefaultFont(
    [Style::FONT_NAME => 'Arial'];
);
$sheet = $excel->sheet();
$headerData = $this->getHeaderData();
$sheet->writeHeader(array_keys($headerData))->applyFontStyleBold();

I then have to do this so the header has the default font agian:

$sheet->writeHeader(array_keys($headerData))->applyFontStyleBold()->applyFontName(self::DEFAULT_FONT_NAME);