Ods Writer skips tables, and Ods Reader reads every database range as the sheet's autofilter
Author: dkulykCreated Sep 30, 2026Updated Sep 30, 2026
This is:
- [x] a bug report
- [ ] a feature request
- [x] **not** a usage questionWhat is the expected behavior?
A Worksheet\Table is written to Ods and read back. LibreOffice keeps a table as a named table:database-range:
<table:database-range table:name="Sales" table:target-range-address="Data.A1:Data.B3" table:display-filter-buttons="true"/>
<table:database-range table:name="NoHead" table:target-range-address="Data.D1:Data.E2" table:contains-header="false"/>This is what LibreOffice writes when it converts a Xlsx with tables to Ods. From the header row of such a range, LibreOffice (master) tags the header cells of a tagged PDF as /TH /Scope /Column.
What is the current behavior?
Writer\Odswrites atable:database-rangeonly for the sheet's autofilter. Tables are dropped, and the header row is/TDin the PDF.Reader\Odsreads each database range as the autofilter of the sheet that is active while reading, the last one, whatever sheet the range names. For the file above, the tables are lost. An autofilter on the first of two sheets, written byWriter\Odsand read back, ends up on the second sheet.
What are the steps to reproduce?
<?php
require __DIR__ . '/vendor/autoload.php';
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Worksheet\Table;
$spreadsheet = new Spreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$sheet->fromArray([['Name', 'Qty'], ['A', 1], ['B', 2]]);
$sheet->addTable(new Table('A1:B3', 'Sales'));
IOFactory::createWriter($spreadsheet, 'Ods')->save('/tmp/table.ods');
var_dump(IOFactory::load('/tmp/table.ods')->getActiveSheet()->getTableNames()); // []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 and master.
Source: PHPOffice/PhpSpreadsheet