tealeg / xlsx

Go library for reading and writing XLSX files.
Other
5.81k stars 808 forks source link

allow recognition of time format in multisection numFormat #781

Closed benedictjohannes closed 9 months ago

benedictjohannes commented 9 months ago

In format_code.go:248-254, it was documented that

Time formats cannot have multiple groups separated by semicolons, there is only one format. Strings are unaffected by the time format.

Apparently Excel 2021 has a default numFormat option that violate that condition: m/d/yy\ h:mm;@
It has two formatting sections. Here is a video I recorded in creating this Excel file.

This commit/PR allows recognition of time format when more than one numFormat section is present, with

Btw, I am coding an Excel parser that needs to cellRef.IsTime() to accurately identify date/time cells. This was the original issue that propelled me to observe and contribute.

ghost commented 9 months ago
👇 Click on the image for a new way to code review #### [![Review these changes using an interactive CodeSee Map](https://s3.us-east-2.amazonaws.com/maps.codesee.io/images/github/tealeg/xlsx/781/f7822e46/1dc43d5ae35efce8a72eb21888cc206a7715c370.svg)](https://app.codesee.io/r/reviews?pr=781&src=https%3A%2F%2Fgithub.com%2Ftealeg%2Fxlsx) #### Legend CodeSee Map legend