PHPSpreadsheet Worksheet Properties setCompany does not work

Viewed 15

I am trying to set the worksheet "Properties" when creating a spreadsheet with PHPSpreadsheet. All fields are working with the code below EXCEPT for setCompany. When I look at the resulting worksheet properties, that field states "Specify the company" so, clearly, PHPSpreadsheet is not updating that field even though all the others are updating properly. Any ideas on how to fix this?

$spreadsheet->getProperties()
            ->setCreator("CPS Report Generator") // Excel Properties: "Author"
            ->setLastModifiedBy("CPS Report Generator") // Excel Properties: "Last Modified By"
            ->setCompany("CPS Inc.")
            ->setTitle($prop_title) // Excel Properties: "Title"
            ->setSubject("CPS Report Generator Export Facility") // Excel Extended Properties: "Subject"
            ->setDescription("Report from CPS") // Excel Extended Properties: "Comments"
            ->setKeywords($prop_tags) // Excel Properties: "Tags"
            ->setCategory($prop_categories); // Excel Properties: "Categories"

In the PHPSpreadsheet help docs, it lists setCompany as an option so I am stymied.

1 Answers

I also posted the above question on the PHPSpreadsheet site and received this answer which satisfies this question because I am writing an Xls NOT an Xlsx. In case this helps someone else, here is what I was told:

Company is an extended property, and that isn't supported by the Xls Writer; but it is written correctly for Xlsx, and as a meta property for Ods

Related