简体   繁体   中英

jsreport excel xml attribute Format ISO-8601 date to custom `d-mmm-yy`

Any idea how to format ISO-8601 date to custom d-mmm-yy ?

I'm struggling to format date from ISO-8601 to custom numFmtId=15 cell. From my searching I found:

I was able to detect whether or not the column header that contains date keyword and whatever column value inside, but I was unable to format it properly.

The best I was able to found on jsreport related thread was: https://jsreport.net/learn/html-to-xlsx which wasn't helping me that much since I was using xlsx recipe.

You can see playground here which contains my progress so far.

To format cell you can add on style.xml :

  `<xf numFmtId="15" fontId="0" fillId="0" borderId="1" xfId="0" applyNumberFormat="1" applyFill="1" applyBorder="1" applyAlignment="1">
     <alignment horizontal="center" />
  </xf>`

And update which part which using that format. example: <ct="d" s="4">

You can see result on Playground here.

The most helpful resources from which I've linked in the question:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM