-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Description
Bug Description
Font strikethrough, set with $cell->getStyle()->getFont()->setStrikethrough(true);, is correctly exported for XLSX but does not appear in ODS export. Example:
$cell = $this->PhpSpreadsheet->getActiveSheet()->getCellByColumnAndRow($curFldCnt, $curRowCnt);
$cell->getStyle()->getFont()->setStrikethrough(true);ODS output does not show strikethrough in LibreOffice or OpenOffice.
Technical Analysis
src/PhpSpreadsheet/Writer/Ods/Cell/Style.phpmethodwriteTextPropertiesdoes not write thestyle:text-line-through-styleorstyle:text-line-through-typeproperties required for ODS strikethrough.- XLSX export includes strikethrough correctly.
Proposed Fix
Add code like this to writeTextProperties:
if ($font->getStrikethrough()) {
$this->writer->writeAttribute('style:text-line-through-style', 'solid');
$this->writer->writeAttribute('style:text-line-through-type', 'single');
}Steps to Reproduce
- Set font strikethrough on a cell.
- Export as ODS.
- Open the file in LibreOffice/OpenOffice.
- Strikethrough does not appear.
Expected Behavior
Strikethrough should be exported and appear in ODS documents.
Environment
- PhpSpreadsheet version: 2.x
- PHP version: 8.2.30
- LibreOffice/OpenOffice version: 26.2.0
Additional Context
This affects all ODS exports with strikethrough. See code in Writer/Ods/Cell/Style.php.
Related issue if found: N/A
Suggested Labels
- bug
- writer/ods
- strikethrough (if available)
Pull Request #4812
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels