Skip to content

Custom properties are missing in xls but do exist in xlsx #1410

@codexp

Description

@codexp

This is:

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

What is the expected behavior?

After setting custom properties, I find them in file's custom properties.

What is the current behavior?

This works for xlsx format, but doesn't for xls.

What are the steps to reproduce?

  • set custom properties
  • save as xls
  • open file in office
  • open custom properties dialog

Please provide a Minimal, Complete, and Verifiable example of code that exhibits the issue without relying on an external Excel file or a web server:

<?php

require __DIR__ . '/vendor/autoload.php';

// Create new Spreadsheet object
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();

$spreadsheet->getProperties()
    ->setCustomProperty('Exported', time(), \PhpOffice\PhpSpreadsheet\Document\Properties::PROPERTY_TYPE_DATE)
    ->setCustomProperty('Version', '1.0')
;

$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xls($spreadsheet);
$writer->save('spreadsheet.xls');

Which versions of PhpSpreadsheet and PHP are affected?

1.8.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions