Phpspreadsheet: Ods writer does not save dimentions (width/height)

Created on 16 Mar 2020  路  8Comments  路  Source: PHPOffice/PhpSpreadsheet

This is:

- [X] a bug report
- [ ] a feature request
- [ ] **not** a usage question (ask them on https://stackoverflow.com/questions/tagged/phpspreadsheet or https://gitter.im/PHPOffice/PhpSpreadsheet)

What is the expected behavior?

changed columns/rows dimensions in ODS

What is the current behavior?

autoSize and setWidth/SetROwHeight does work in PhpSpreadsheet, but Ods writer ignores them

What are the steps to reproduce?

<?php
require 'vendor/autoload.php';

use PhpOffice\PhpSpreadsheet\IOFactory,
    PhpOffice\PhpSpreadsheet\Spreadsheet;

$spreadsheet = new Spreadsheet();
$sheet       = $spreadsheet->getActiveSheet();
$sheet->getCell("A1")->setValue("test");
$sheet->getColumnDimension('A')->setWidth(20.0);
$sheet->getRowDimension(1)->setRowHeight(50.0);

IOFactory::createWriter($spreadsheet, "Ods")->save("test.ods");  // width, heigh are default
IOFactory::createWriter($spreadsheet, "Xlsx")->save("test.xlsx"); // width, height are as expected

Which versions of PhpSpreadsheet and PHP are affected?

composer "phpoffice/phpspreadsheet": "dev-master" , 1.11.0
PHP 7.2.24

stale

All 8 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.

I'm experiencing the same bug

I have the same bug.

The thing I finally did is to use only .xlsx export and open it with LibreOffice, gives better results

My project requires exporting .ods.
The ods writer is missing a lot of format support, like border, alignment, font size, etc.
My solution is using libreoffice to convert .xlsx to .ods.
The command used for converting is
soffice --headless --convert-to ods example.xlsx
The output will be example.ods

Ah, nice trick !

This bug is still present in 1.17.1.

Just ran into this issue. Issue seems to need reopening.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

isopen picture isopen  路  3Comments

emeraldjava picture emeraldjava  路  4Comments

garnold picture garnold  路  5Comments

huichen2017 picture huichen2017  路  4Comments

Typel picture Typel  路  5Comments