Ods Reader: the hyperlink of a non-text cell in a LibreOffice file is lost
Author: dkulykCreated Sep 28, 2026Updated Sep 28, 2026
This is:
- [x] a bug report
- [ ] a feature request
- [x] **not** a usage questionWhat is the expected behavior?
A hyperlink on a number, boolean, date or formula cell in an Ods file saved by LibreOffice is read.
What is the current behavior?
LibreOffice does not write such a link as text:a. It keeps it in the cell's automatic style:
<style:style style:name="ce2" style:family="table-cell">
<style:table-cell-properties>
<style:hyperlink xlink:href="https://example.org/2" xlink:type="simple"/>
<loext:hyperlink xlink:href="https://example.org/2" xlink:type="simple"/>
</style:table-cell-properties>
</style:style>This is what LibreOffice writes when it converts a Xlsx file with links on such cells to Ods (sc/source/filter/xml/xmlstyle.cxx, CTF_SC_HYPERLINK). Reader\Ods looks only for text:a, so the link is lost.
What are the steps to reproduce?
- Save a Xlsx file with a link on a number cell:
<?php
require __DIR__ . '/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->setCellValue('A1', 42);
$sheet->getCell('A1')->getHyperlink()->setUrl('https://example.org');
IOFactory::createWriter($spreadsheet, 'Xlsx')->save('/tmp/link.xlsx');soffice --headless --convert-to ods /tmp/link.xlsx --outdir /tmpvar_dump(IOFactory::load('/tmp/link.ods')->getActiveSheet()->getCell('A1')->hasHyperlink()); // false
What features do you think are causing the issue
- Reader
- Writer
Does an issue affect all spreadsheet file formats? If not, which formats are affected?
Ods only.
Which versions of PhpSpreadsheet and PHP are affected?
master, PHP 8.5; LibreOffice 26.8.
Source: PHPOffice/PhpSpreadsheet