mk-j / PHP_XLSXWriter

Lightweight XLSX Excel Spreadsheet Writer in PHP
MIT License
1.84k stars 664 forks source link

Implement explicitly setting column types #250

Closed penzin closed 1 year ago

penzin commented 4 years ago

I've faced with needs to explicitly set column types, so I've decided to separate set column types method and set header method. Because it was impossible, for example, set types for columns with the same names. See ex12-column-types.php.

seattledeveloper commented 4 years ago

I agree with @penzin ... I have run across a case just last week where I really needed to have 2 sets of column headings have the same value, and I ended up having to go with a _1 and _2 added to the name. I would really like to see the option of the header array being able to be separated into 2 arrays, one for names and one for types.

For backwards compatibility, it seems that writeSheetHeader() would need a 4th optional parameter for the second array (either the column names or the types), that if not set, the function would behave as it does now. I believe that it is rare that multiple column names share the same value, but it does happen, as it did for me the first time last week.

Thanks!

penzin commented 1 year ago

As #251 resolved, closing this PR