styles.go 83 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722
  1. package excelize
  2. import (
  3. "encoding/json"
  4. "encoding/xml"
  5. "fmt"
  6. "math"
  7. "strconv"
  8. "strings"
  9. )
  10. // Excel styles can reference number formats that are built-in, all of which
  11. // have an id less than 164. This is a possibly incomplete list comprised of as
  12. // many of them as I could find.
  13. var builtInNumFmt = map[int]string{
  14. 0: "general",
  15. 1: "0",
  16. 2: "0.00",
  17. 3: "#,##0",
  18. 4: "#,##0.00",
  19. 9: "0%",
  20. 10: "0.00%",
  21. 11: "0.00e+00",
  22. 12: "# ?/?",
  23. 13: "# ??/??",
  24. 14: "mm-dd-yy",
  25. 15: "d-mmm-yy",
  26. 16: "d-mmm",
  27. 17: "mmm-yy",
  28. 18: "h:mm am/pm",
  29. 19: "h:mm:ss am/pm",
  30. 20: "h:mm",
  31. 21: "h:mm:ss",
  32. 22: "m/d/yy h:mm",
  33. 37: "#,##0 ;(#,##0)",
  34. 38: "#,##0 ;[red](#,##0)",
  35. 39: "#,##0.00;(#,##0.00)",
  36. 40: "#,##0.00;[red](#,##0.00)",
  37. 41: `_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)`,
  38. 42: `_("$"* #,##0_);_("$* \(#,##0\);_("$"* "-"_);_(@_)`,
  39. 43: `_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)`,
  40. 44: `_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)`,
  41. 45: "mm:ss",
  42. 46: "[h]:mm:ss",
  43. 47: "mmss.0",
  44. 48: "##0.0e+0",
  45. 49: "@",
  46. }
  47. // langNumFmt defined number format code (with unicode values provided for
  48. // language glyphs where they occur) in different language.
  49. var langNumFmt = map[string]map[int]string{
  50. "zh-tw": {
  51. 27: "[$-404]e/m/d",
  52. 28: `[$-404]e"年"m"月"d"日"`,
  53. 29: `[$-404]e"年"m"月"d"日"`,
  54. 30: "m/d/yy",
  55. 31: `yyyy"年"m"月"d"日"`,
  56. 32: `hh"時"mm"分"`,
  57. 33: `hh"時"mm"分"ss"秒"`,
  58. 34: `上午/下午 hh"時"mm"分"`,
  59. 35: `上午/下午 hh"時"mm"分"ss"秒"`,
  60. 36: "[$-404]e/m/d",
  61. 50: "[$-404]e/m/d",
  62. 51: `[$-404]e"年"m"月"d"日"`,
  63. 52: `上午/下午 hh"時"mm"分"`,
  64. 53: `上午/下午 hh"時"mm"分"ss"秒"`,
  65. 54: `[$-404]e"年"m"月"d"日"`,
  66. 55: `上午/下午 hh"時"mm"分"`,
  67. 56: `上午/下午 hh"時"mm"分"ss"秒"`,
  68. 57: "[$-404]e/m/d",
  69. 58: `[$-404]e"年"m"月"d"日"`,
  70. },
  71. "zh-cn": {
  72. 27: `yyyy"年"m"月"`,
  73. 28: `m"月"d"日"`,
  74. 29: `m"月"d"日"`,
  75. 30: "m-d-yy",
  76. 31: `yyyy"年"m"月"d"日"`,
  77. 32: `h"时"mm"分"`,
  78. 33: `h"时"mm"分"ss"秒"`,
  79. 34: `上午/下午 h"时"mm"分"`,
  80. 35: `上午/下午 h"时"mm"分"ss"秒"`,
  81. 36: `yyyy"年"m"月"`,
  82. 50: `yyyy"年"m"月"`,
  83. 51: `m"月"d"日"`,
  84. 52: `yyyy"年"m"月"`,
  85. 53: `m"月"d"日"`,
  86. 54: `m"月"d"日"`,
  87. 55: `上午/下午 h"时"mm"分"`,
  88. 56: `上午/下午 h"时"mm"分"ss"秒"`,
  89. 57: `yyyy"年"m"月"`,
  90. 58: `m"月"d"日"`,
  91. },
  92. "zh-tw_unicode": {
  93. 27: "[$-404]e/m/d",
  94. 28: `[$-404]e"5E74"m"6708"d"65E5"`,
  95. 29: `[$-404]e"5E74"m"6708"d"65E5"`,
  96. 30: "m/d/yy",
  97. 31: `yyyy"5E74"m"6708"d"65E5"`,
  98. 32: `hh"6642"mm"5206"`,
  99. 33: `hh"6642"mm"5206"ss"79D2"`,
  100. 34: `4E0A5348/4E0B5348hh"6642"mm"5206"`,
  101. 35: `4E0A5348/4E0B5348hh"6642"mm"5206"ss"79D2"`,
  102. 36: "[$-404]e/m/d",
  103. 50: "[$-404]e/m/d",
  104. 51: `[$-404]e"5E74"m"6708"d"65E5"`,
  105. 52: `4E0A5348/4E0B5348hh"6642"mm"5206"`,
  106. 53: `4E0A5348/4E0B5348hh"6642"mm"5206"ss"79D2"`,
  107. 54: `[$-404]e"5E74"m"6708"d"65E5"`,
  108. 55: `4E0A5348/4E0B5348hh"6642"mm"5206"`,
  109. 56: `4E0A5348/4E0B5348hh"6642"mm"5206"ss"79D2"`,
  110. 57: "[$-404]e/m/d",
  111. 58: `[$-404]e"5E74"m"6708"d"65E5"`,
  112. },
  113. "zh-cn_unicode": {
  114. 27: `yyyy"5E74"m"6708"`,
  115. 28: `m"6708"d"65E5"`,
  116. 29: `m"6708"d"65E5"`,
  117. 30: "m-d-yy",
  118. 31: `yyyy"5E74"m"6708"d"65E5"`,
  119. 32: `h"65F6"mm"5206"`,
  120. 33: `h"65F6"mm"5206"ss"79D2"`,
  121. 34: `4E0A5348/4E0B5348h"65F6"mm"5206"`,
  122. 35: `4E0A5348/4E0B5348h"65F6"mm"5206"ss"79D2"`,
  123. 36: `yyyy"5E74"m"6708"`,
  124. 50: `yyyy"5E74"m"6708"`,
  125. 51: `m"6708"d"65E5"`,
  126. 52: `yyyy"5E74"m"6708"`,
  127. 53: `m"6708"d"65E5"`,
  128. 54: `m"6708"d"65E5"`,
  129. 55: `4E0A5348/4E0B5348h"65F6"mm"5206"`,
  130. 56: `4E0A5348/4E0B5348h"65F6"mm"5206"ss"79D2"`,
  131. 57: `yyyy"5E74"m"6708"`,
  132. 58: `m"6708"d"65E5"`,
  133. },
  134. "ja-jp": {
  135. 27: "[$-411]ge.m.d",
  136. 28: `[$-411]ggge"年"m"月"d"日"`,
  137. 29: `[$-411]ggge"年"m"月"d"日"`,
  138. 30: "m/d/yy",
  139. 31: `yyyy"年"m"月"d"日"`,
  140. 32: `h"時"mm"分"`,
  141. 33: `h"時"mm"分"ss"秒"`,
  142. 34: `yyyy"年"m"月"`,
  143. 35: `m"月"d"日"`,
  144. 36: "[$-411]ge.m.d",
  145. 50: "[$-411]ge.m.d",
  146. 51: `[$-411]ggge"年"m"月"d"日"`,
  147. 52: `yyyy"年"m"月"`,
  148. 53: `m"月"d"日"`,
  149. 54: `[$-411]ggge"年"m"月"d"日"`,
  150. 55: `yyyy"年"m"月"`,
  151. 56: `m"月"d"日"`,
  152. 57: "[$-411]ge.m.d",
  153. 58: `[$-411]ggge"年"m"月"d"日"`,
  154. },
  155. "ko-kr": {
  156. 27: `yyyy"年" mm"月" dd"日"`,
  157. 28: "mm-dd",
  158. 29: "mm-dd",
  159. 30: "mm-dd-yy",
  160. 31: `yyyy"년" mm"월" dd"일"`,
  161. 32: `h"시" mm"분"`,
  162. 33: `h"시" mm"분" ss"초"`,
  163. 34: `yyyy-mm-dd`,
  164. 35: `yyyy-mm-dd`,
  165. 36: `yyyy"年" mm"月" dd"日"`,
  166. 50: `yyyy"年" mm"月" dd"日"`,
  167. 51: "mm-dd",
  168. 52: "yyyy-mm-dd",
  169. 53: "yyyy-mm-dd",
  170. 54: "mm-dd",
  171. 55: "yyyy-mm-dd",
  172. 56: "yyyy-mm-dd",
  173. 57: `yyyy"年" mm"月" dd"日"`,
  174. 58: "mm-dd",
  175. },
  176. "ja-jp_unicode": {
  177. 27: "[$-411]ge.m.d",
  178. 28: `[$-411]ggge"5E74"m"6708"d"65E5"`,
  179. 29: `[$-411]ggge"5E74"m"6708"d"65E5"`,
  180. 30: "m/d/yy",
  181. 31: `yyyy"5E74"m"6708"d"65E5"`,
  182. 32: `h"6642"mm"5206"`,
  183. 33: `h"6642"mm"5206"ss"79D2"`,
  184. 34: `yyyy"5E74"m"6708"`,
  185. 35: `m"6708"d"65E5"`,
  186. 36: "[$-411]ge.m.d",
  187. 50: "[$-411]ge.m.d",
  188. 51: `[$-411]ggge"5E74"m"6708"d"65E5"`,
  189. 52: `yyyy"5E74"m"6708"`,
  190. 53: `m"6708"d"65E5"`,
  191. 54: `[$-411]ggge"5E74"m"6708"d"65E5"`,
  192. 55: `yyyy"5E74"m"6708"`,
  193. 56: `m"6708"d"65E5"`,
  194. 57: "[$-411]ge.m.d",
  195. 58: `[$-411]ggge"5E74"m"6708"d"65E5"`,
  196. },
  197. "ko-kr_unicode": {
  198. 27: `yyyy"5E74" mm"6708" dd"65E5"`,
  199. 28: "mm-dd",
  200. 29: "mm-dd",
  201. 30: "mm-dd-yy",
  202. 31: `yyyy"B144" mm"C6D4" dd"C77C"`,
  203. 32: `h"C2DC" mm"BD84"`,
  204. 33: `h"C2DC" mm"BD84" ss"CD08"`,
  205. 34: "yyyy-mm-dd",
  206. 35: "yyyy-mm-dd",
  207. 36: `yyyy"5E74" mm"6708" dd"65E5"`,
  208. 50: `yyyy"5E74" mm"6708" dd"65E5"`,
  209. 51: "mm-dd",
  210. 52: "yyyy-mm-dd",
  211. 53: "yyyy-mm-dd",
  212. 54: "mm-dd",
  213. 55: "yyyy-mm-dd",
  214. 56: "yyyy-mm-dd",
  215. 57: `yyyy"5E74" mm"6708" dd"65E5"`,
  216. 58: "mm-dd",
  217. },
  218. "th-th": {
  219. 59: "t0",
  220. 60: "t0.00",
  221. 61: "t#,##0",
  222. 62: "t#,##0.00",
  223. 67: "t0%",
  224. 68: "t0.00%",
  225. 69: "t# ?/?",
  226. 70: "t# ??/??",
  227. 71: "ว/ด/ปปปป",
  228. 72: "ว-ดดด-ปป",
  229. 73: "ว-ดดด",
  230. 74: "ดดด-ปป",
  231. 75: "ช:นน",
  232. 76: "ช:นน:ทท",
  233. 77: "ว/ด/ปปปป ช:นน",
  234. 78: "นน:ทท",
  235. 79: "[ช]:นน:ทท",
  236. 80: "นน:ทท.0",
  237. 81: "d/m/bb",
  238. },
  239. "th-th_unicode": {
  240. 59: "t0",
  241. 60: "t0.00",
  242. 61: "t#,##0",
  243. 62: "t#,##0.00",
  244. 67: "t0%",
  245. 68: "t0.00%",
  246. 69: "t# ?/?",
  247. 70: "t# ??/??",
  248. 71: "0E27/0E14/0E1B0E1B0E1B0E1B",
  249. 72: "0E27-0E140E140E14-0E1B0E1B",
  250. 73: "0E27-0E140E140E14",
  251. 74: "0E140E140E14-0E1B0E1B",
  252. 75: "0E0A:0E190E19",
  253. 76: "0E0A:0E190E19:0E170E17",
  254. 77: "0E27/0E14/0E1B0E1B0E1B0E1B 0E0A:0E190E19",
  255. 78: "0E190E19:0E170E17",
  256. 79: "[0E0A]:0E190E19:0E170E17",
  257. 80: "0E190E19:0E170E17.0",
  258. 81: "d/m/bb",
  259. },
  260. }
  261. // currencyNumFmt defined the currency number format map.
  262. var currencyNumFmt = map[int]string{
  263. 164: `"CN¥",##0.00`,
  264. 165: "[$$-409]#,##0.00",
  265. 166: "[$$-45C]#,##0.00",
  266. 167: "[$$-1004]#,##0.00",
  267. 168: "[$$-404]#,##0.00",
  268. 169: "[$$-C09]#,##0.00",
  269. 170: "[$$-2809]#,##0.00",
  270. 171: "[$$-1009]#,##0.00",
  271. 172: "[$$-2009]#,##0.00",
  272. 173: "[$$-1409]#,##0.00",
  273. 174: "[$$-4809]#,##0.00",
  274. 175: "[$$-2C09]#,##0.00",
  275. 176: "[$$-2409]#,##0.00",
  276. 177: "[$$-1000]#,##0.00",
  277. 178: `#,##0.00\ [$$-C0C]`,
  278. 179: "[$$-475]#,##0.00",
  279. 180: "[$$-83E]#,##0.00",
  280. 181: `[$$-86B]\ #,##0.00`,
  281. 182: `[$$-340A]\ #,##0.00`,
  282. 183: "[$$-240A]#,##0.00",
  283. 184: `[$$-300A]\ #,##0.00`,
  284. 185: "[$$-440A]#,##0.00",
  285. 186: "[$$-80A]#,##0.00",
  286. 187: "[$$-500A]#,##0.00",
  287. 188: "[$$-540A]#,##0.00",
  288. 189: `[$$-380A]\ #,##0.00`,
  289. 190: "[$£-809]#,##0.00",
  290. 191: "[$£-491]#,##0.00",
  291. 192: "[$£-452]#,##0.00",
  292. 193: "[$¥-804]#,##0.00",
  293. 194: "[$¥-411]#,##0.00",
  294. 195: "[$¥-478]#,##0.00",
  295. 196: "[$¥-451]#,##0.00",
  296. 197: "[$¥-480]#,##0.00",
  297. 198: "#,##0.00\\ [$\u058F-42B]",
  298. 199: "[$\u060B-463]#,##0.00",
  299. 200: "[$\u060B-48C]#,##0.00",
  300. 201: "[$\u09F3-845]\\ #,##0.00",
  301. 202: "#,##0.00[$\u17DB-453]",
  302. 203: "[$\u20A1-140A]#,##0.00",
  303. 204: "[$\u20A6-468]\\ #,##0.00",
  304. 205: "[$\u20A6-470]\\ #,##0.00",
  305. 206: "[$\u20A9-412]#,##0.00",
  306. 207: "[$\u20AA-40D]\\ #,##0.00",
  307. 208: "#,##0.00\\ [$\u20AB-42A]",
  308. 209: "#,##0.00\\ [$\u20AC-42D]",
  309. 210: "#,##0.00\\ [$\u20AC-47E]",
  310. 211: "#,##0.00\\ [$\u20AC-403]",
  311. 212: "#,##0.00\\ [$\u20AC-483]",
  312. 213: "[$\u20AC-813]\\ #,##0.00",
  313. 214: "[$\u20AC-413]\\ #,##0.00",
  314. 215: "[$\u20AC-1809]#,##0.00",
  315. 216: "#,##0.00\\ [$\u20AC-425]",
  316. 217: "[$\u20AC-2]\\ #,##0.00",
  317. 218: "#,##0.00\\ [$\u20AC-1]",
  318. 219: "#,##0.00\\ [$\u20AC-40B]",
  319. 220: "#,##0.00\\ [$\u20AC-80C]",
  320. 221: "#,##0.00\\ [$\u20AC-40C]",
  321. 222: "#,##0.00\\ [$\u20AC-140C]",
  322. 223: "#,##0.00\\ [$\u20AC-180C]",
  323. 224: "[$\u20AC-200C]#,##0.00",
  324. 225: "#,##0.00\\ [$\u20AC-456]",
  325. 226: "#,##0.00\\ [$\u20AC-C07]",
  326. 227: "#,##0.00\\ [$\u20AC-407]",
  327. 228: "#,##0.00\\ [$\u20AC-1007]",
  328. 229: "#,##0.00\\ [$\u20AC-408]",
  329. 230: "#,##0.00\\ [$\u20AC-243B]",
  330. 231: "[$\u20AC-83C]#,##0.00",
  331. 232: "[$\u20AC-410]\\ #,##0.00",
  332. 233: "[$\u20AC-476]#,##0.00",
  333. 234: "#,##0.00\\ [$\u20AC-2C1A]",
  334. 235: "[$\u20AC-426]\\ #,##0.00",
  335. 236: "#,##0.00\\ [$\u20AC-427]",
  336. 237: "#,##0.00\\ [$\u20AC-82E]",
  337. 238: "#,##0.00\\ [$\u20AC-46E]",
  338. 239: "[$\u20AC-43A]#,##0.00",
  339. 240: "#,##0.00\\ [$\u20AC-C3B]",
  340. 241: "#,##0.00\\ [$\u20AC-482]",
  341. 242: "#,##0.00\\ [$\u20AC-816]",
  342. 243: "#,##0.00\\ [$\u20AC-301A]",
  343. 244: "#,##0.00\\ [$\u20AC-203B]",
  344. 245: "#,##0.00\\ [$\u20AC-41B]",
  345. 246: "#,##0.00\\ [$\u20AC-424]",
  346. 247: "#,##0.00\\ [$\u20AC-C0A]",
  347. 248: "#,##0.00\\ [$\u20AC-81D]",
  348. 249: "#,##0.00\\ [$\u20AC-484]",
  349. 250: "#,##0.00\\ [$\u20AC-42E]",
  350. 251: "[$\u20AC-462]\\ #,##0.00",
  351. 252: "#,##0.00\\ [$₭-454]",
  352. 253: "#,##0.00\\ [$₮-450]",
  353. 254: "[$\u20AE-C50]#,##0.00",
  354. 255: "[$\u20B1-3409]#,##0.00",
  355. 256: "[$\u20B1-464]#,##0.00",
  356. 257: "#,##0.00[$\u20B4-422]",
  357. 258: "[$\u20B8-43F]#,##0.00",
  358. 259: "[$\u20B9-460]#,##0.00",
  359. 260: "[$\u20B9-4009]\\ #,##0.00",
  360. 261: "[$\u20B9-447]\\ #,##0.00",
  361. 262: "[$\u20B9-439]\\ #,##0.00",
  362. 263: "[$\u20B9-44B]\\ #,##0.00",
  363. 264: "[$\u20B9-860]#,##0.00",
  364. 265: "[$\u20B9-457]\\ #,##0.00",
  365. 266: "[$\u20B9-458]#,##0.00",
  366. 267: "[$\u20B9-44E]\\ #,##0.00",
  367. 268: "[$\u20B9-861]#,##0.00",
  368. 269: "[$\u20B9-448]\\ #,##0.00",
  369. 270: "[$\u20B9-446]\\ #,##0.00",
  370. 271: "[$\u20B9-44F]\\ #,##0.00",
  371. 272: "[$\u20B9-459]#,##0.00",
  372. 273: "[$\u20B9-449]\\ #,##0.00",
  373. 274: "[$\u20B9-820]#,##0.00",
  374. 275: "#,##0.00\\ [$\u20BA-41F]",
  375. 276: "#,##0.00\\ [$\u20BC-42C]",
  376. 277: "#,##0.00\\ [$\u20BC-82C]",
  377. 278: "#,##0.00\\ [$\u20BD-419]",
  378. 279: "#,##0.00[$\u20BD-485]",
  379. 280: "#,##0.00\\ [$\u20BE-437]",
  380. 281: "[$B/.-180A]\\ #,##0.00",
  381. 282: "[$Br-472]#,##0.00",
  382. 283: "[$Br-477]#,##0.00",
  383. 284: "#,##0.00[$Br-473]",
  384. 285: "[$Bs-46B]\\ #,##0.00",
  385. 286: "[$Bs-400A]\\ #,##0.00",
  386. 287: "[$Bs.-200A]\\ #,##0.00",
  387. 288: "[$BWP-832]\\ #,##0.00",
  388. 289: "[$C$-4C0A]#,##0.00",
  389. 290: "[$CA$-85D]#,##0.00",
  390. 291: "[$CA$-47C]#,##0.00",
  391. 292: "[$CA$-45D]#,##0.00",
  392. 293: "[$CFA-340C]#,##0.00",
  393. 294: "[$CFA-280C]#,##0.00",
  394. 295: "#,##0.00\\ [$CFA-867]",
  395. 296: "#,##0.00\\ [$CFA-488]",
  396. 297: "#,##0.00\\ [$CHF-100C]",
  397. 298: "[$CHF-1407]\\ #,##0.00",
  398. 299: "[$CHF-807]\\ #,##0.00",
  399. 300: "[$CHF-810]\\ #,##0.00",
  400. 301: "[$CHF-417]\\ #,##0.00",
  401. 302: "[$CLP-47A]\\ #,##0.00",
  402. 303: "[$CN¥-850]#,##0.00",
  403. 304: "#,##0.00\\ [$DZD-85F]",
  404. 305: "[$FCFA-2C0C]#,##0.00",
  405. 306: "#,##0.00\\ [$Ft-40E]",
  406. 307: "[$G-3C0C]#,##0.00",
  407. 308: "[$Gs.-3C0A]\\ #,##0.00",
  408. 309: "[$GTQ-486]#,##0.00",
  409. 310: "[$HK$-C04]#,##0.00",
  410. 311: "[$HK$-3C09]#,##0.00",
  411. 312: "#,##0.00\\ [$HRK-41A]",
  412. 313: "[$IDR-3809]#,##0.00",
  413. 314: "[$IQD-492]#,##0.00",
  414. 315: "#,##0.00\\ [$ISK-40F]",
  415. 316: "[$K-455]#,##0.00",
  416. 317: "#,##0.00\\ [$K\u010D-405]",
  417. 318: "#,##0.00\\ [$KM-141A]",
  418. 319: "#,##0.00\\ [$KM-101A]",
  419. 320: "#,##0.00\\ [$KM-181A]",
  420. 321: "[$kr-438]\\ #,##0.00",
  421. 322: "[$kr-43B]\\ #,##0.00",
  422. 323: "#,##0.00\\ [$kr-83B]",
  423. 324: "[$kr-414]\\ #,##0.00",
  424. 325: "[$kr-814]\\ #,##0.00",
  425. 326: "#,##0.00\\ [$kr-41D]",
  426. 327: "[$kr.-406]\\ #,##0.00",
  427. 328: "[$kr.-46F]\\ #,##0.00",
  428. 329: "[$Ksh-441]#,##0.00",
  429. 330: "[$L-818]#,##0.00",
  430. 331: "[$L-819]#,##0.00",
  431. 332: "[$L-480A]\\ #,##0.00",
  432. 333: "#,##0.00\\ [$Lek\u00EB-41C]",
  433. 334: "[$MAD-45F]#,##0.00",
  434. 335: "[$MAD-380C]#,##0.00",
  435. 336: "#,##0.00\\ [$MAD-105F]",
  436. 337: "[$MOP$-1404]#,##0.00",
  437. 338: "#,##0.00\\ [$MVR-465]_-",
  438. 339: "#,##0.00[$Nfk-873]",
  439. 340: "[$NGN-466]#,##0.00",
  440. 341: "[$NGN-467]#,##0.00",
  441. 342: "[$NGN-469]#,##0.00",
  442. 343: "[$NGN-471]#,##0.00",
  443. 344: "[$NOK-103B]\\ #,##0.00",
  444. 345: "[$NOK-183B]\\ #,##0.00",
  445. 346: "[$NZ$-481]#,##0.00",
  446. 347: "[$PKR-859]\\ #,##0.00",
  447. 348: "[$PYG-474]#,##0.00",
  448. 349: "[$Q-100A]#,##0.00",
  449. 350: "[$R-436]\\ #,##0.00",
  450. 351: "[$R-1C09]\\ #,##0.00",
  451. 352: "[$R-435]\\ #,##0.00",
  452. 353: "[$R$-416]\\ #,##0.00",
  453. 354: "[$RD$-1C0A]#,##0.00",
  454. 355: "#,##0.00\\ [$RF-487]",
  455. 356: "[$RM-4409]#,##0.00",
  456. 357: "[$RM-43E]#,##0.00",
  457. 358: "#,##0.00\\ [$RON-418]",
  458. 359: "[$Rp-421]#,##0.00",
  459. 360: "[$Rs-420]#,##0.00_-",
  460. 361: "[$Rs.-849]\\ #,##0.00",
  461. 362: "#,##0.00\\ [$RSD-81A]",
  462. 363: "#,##0.00\\ [$RSD-C1A]",
  463. 364: "#,##0.00\\ [$RUB-46D]",
  464. 365: "#,##0.00\\ [$RUB-444]",
  465. 366: "[$S/.-C6B]\\ #,##0.00",
  466. 367: "[$S/.-280A]\\ #,##0.00",
  467. 368: "#,##0.00\\ [$SEK-143B]",
  468. 369: "#,##0.00\\ [$SEK-1C3B]",
  469. 370: "#,##0.00\\ [$so\u02BBm-443]",
  470. 371: "#,##0.00\\ [$so\u02BBm-843]",
  471. 372: "#,##0.00\\ [$SYP-45A]",
  472. 373: "[$THB-41E]#,##0.00",
  473. 374: "#,##0.00[$TMT-442]",
  474. 375: "[$US$-3009]#,##0.00",
  475. 376: "[$ZAR-46C]\\ #,##0.00",
  476. 377: "[$ZAR-430]#,##0.00",
  477. 378: "[$ZAR-431]#,##0.00",
  478. 379: "[$ZAR-432]\\ #,##0.00",
  479. 380: "[$ZAR-433]#,##0.00",
  480. 381: "[$ZAR-434]\\ #,##0.00",
  481. 382: "#,##0.00\\ [$z\u0142-415]",
  482. 383: "#,##0.00\\ [$\u0434\u0435\u043D-42F]",
  483. 384: "#,##0.00\\ [$КМ-201A]",
  484. 385: "#,##0.00\\ [$КМ-1C1A]",
  485. 386: "#,##0.00\\ [$\u043B\u0432.-402]",
  486. 387: "#,##0.00\\ [$р.-423]",
  487. 388: "#,##0.00\\ [$\u0441\u043E\u043C-440]",
  488. 389: "#,##0.00\\ [$\u0441\u043E\u043C-428]",
  489. 390: "[$\u062C.\u0645.-C01]\\ #,##0.00_-",
  490. 391: "[$\u062F.\u0623.-2C01]\\ #,##0.00_-",
  491. 392: "[$\u062F.\u0625.-3801]\\ #,##0.00_-",
  492. 393: "[$\u062F.\u0628.-3C01]\\ #,##0.00_-",
  493. 394: "[$\u062F.\u062A.-1C01]\\ #,##0.00_-",
  494. 395: "[$\u062F.\u062C.-1401]\\ #,##0.00_-",
  495. 396: "[$\u062F.\u0639.-801]\\ #,##0.00_-",
  496. 397: "[$\u062F.\u0643.-3401]\\ #,##0.00_-",
  497. 398: "[$\u062F.\u0644.-1001]#,##0.00_-",
  498. 399: "[$\u062F.\u0645.-1801]\\ #,##0.00_-",
  499. 400: "[$\u0631-846]\\ #,##0.00",
  500. 401: "[$\u0631.\u0633.-401]\\ #,##0.00_-",
  501. 402: "[$\u0631.\u0639.-2001]\\ #,##0.00_-",
  502. 403: "[$\u0631.\u0642.-4001]\\ #,##0.00_-",
  503. 404: "[$\u0631.\u064A.-2401]\\ #,##0.00_-",
  504. 405: "[$\u0631\u06CC\u0627\u0644-429]#,##0.00_-",
  505. 406: "[$\u0644.\u0633.-2801]\\ #,##0.00_-",
  506. 407: "[$\u0644.\u0644.-3001]\\ #,##0.00_-",
  507. 408: "[$\u1265\u122D-45E]#,##0.00",
  508. 409: "[$\u0930\u0942-461]#,##0.00",
  509. 410: "[$\u0DBB\u0DD4.-45B]\\ #,##0.00",
  510. 411: "[$ADP]\\ #,##0.00",
  511. 412: "[$AED]\\ #,##0.00",
  512. 413: "[$AFA]\\ #,##0.00",
  513. 414: "[$AFN]\\ #,##0.00",
  514. 415: "[$ALL]\\ #,##0.00",
  515. 416: "[$AMD]\\ #,##0.00",
  516. 417: "[$ANG]\\ #,##0.00",
  517. 418: "[$AOA]\\ #,##0.00",
  518. 419: "[$ARS]\\ #,##0.00",
  519. 420: "[$ATS]\\ #,##0.00",
  520. 421: "[$AUD]\\ #,##0.00",
  521. 422: "[$AWG]\\ #,##0.00",
  522. 423: "[$AZM]\\ #,##0.00",
  523. 424: "[$AZN]\\ #,##0.00",
  524. 425: "[$BAM]\\ #,##0.00",
  525. 426: "[$BBD]\\ #,##0.00",
  526. 427: "[$BDT]\\ #,##0.00",
  527. 428: "[$BEF]\\ #,##0.00",
  528. 429: "[$BGL]\\ #,##0.00",
  529. 430: "[$BGN]\\ #,##0.00",
  530. 431: "[$BHD]\\ #,##0.00",
  531. 432: "[$BIF]\\ #,##0.00",
  532. 433: "[$BMD]\\ #,##0.00",
  533. 434: "[$BND]\\ #,##0.00",
  534. 435: "[$BOB]\\ #,##0.00",
  535. 436: "[$BOV]\\ #,##0.00",
  536. 437: "[$BRL]\\ #,##0.00",
  537. 438: "[$BSD]\\ #,##0.00",
  538. 439: "[$BTN]\\ #,##0.00",
  539. 440: "[$BWP]\\ #,##0.00",
  540. 441: "[$BYR]\\ #,##0.00",
  541. 442: "[$BZD]\\ #,##0.00",
  542. 443: "[$CAD]\\ #,##0.00",
  543. 444: "[$CDF]\\ #,##0.00",
  544. 445: "[$CHE]\\ #,##0.00",
  545. 446: "[$CHF]\\ #,##0.00",
  546. 447: "[$CHW]\\ #,##0.00",
  547. 448: "[$CLF]\\ #,##0.00",
  548. 449: "[$CLP]\\ #,##0.00",
  549. 450: "[$CNY]\\ #,##0.00",
  550. 451: "[$COP]\\ #,##0.00",
  551. 452: "[$COU]\\ #,##0.00",
  552. 453: "[$CRC]\\ #,##0.00",
  553. 454: "[$CSD]\\ #,##0.00",
  554. 455: "[$CUC]\\ #,##0.00",
  555. 456: "[$CVE]\\ #,##0.00",
  556. 457: "[$CYP]\\ #,##0.00",
  557. 458: "[$CZK]\\ #,##0.00",
  558. 459: "[$DEM]\\ #,##0.00",
  559. 460: "[$DJF]\\ #,##0.00",
  560. 461: "[$DKK]\\ #,##0.00",
  561. 462: "[$DOP]\\ #,##0.00",
  562. 463: "[$DZD]\\ #,##0.00",
  563. 464: "[$ECS]\\ #,##0.00",
  564. 465: "[$ECV]\\ #,##0.00",
  565. 466: "[$EEK]\\ #,##0.00",
  566. 467: "[$EGP]\\ #,##0.00",
  567. 468: "[$ERN]\\ #,##0.00",
  568. 469: "[$ESP]\\ #,##0.00",
  569. 470: "[$ETB]\\ #,##0.00",
  570. 471: "[$EUR]\\ #,##0.00",
  571. 472: "[$FIM]\\ #,##0.00",
  572. 473: "[$FJD]\\ #,##0.00",
  573. 474: "[$FKP]\\ #,##0.00",
  574. 475: "[$FRF]\\ #,##0.00",
  575. 476: "[$GBP]\\ #,##0.00",
  576. 477: "[$GEL]\\ #,##0.00",
  577. 478: "[$GHC]\\ #,##0.00",
  578. 479: "[$GHS]\\ #,##0.00",
  579. 480: "[$GIP]\\ #,##0.00",
  580. 481: "[$GMD]\\ #,##0.00",
  581. 482: "[$GNF]\\ #,##0.00",
  582. 483: "[$GRD]\\ #,##0.00",
  583. 484: "[$GTQ]\\ #,##0.00",
  584. 485: "[$GYD]\\ #,##0.00",
  585. 486: "[$HKD]\\ #,##0.00",
  586. 487: "[$HNL]\\ #,##0.00",
  587. 488: "[$HRK]\\ #,##0.00",
  588. 489: "[$HTG]\\ #,##0.00",
  589. 490: "[$HUF]\\ #,##0.00",
  590. 491: "[$IDR]\\ #,##0.00",
  591. 492: "[$IEP]\\ #,##0.00",
  592. 493: "[$ILS]\\ #,##0.00",
  593. 494: "[$INR]\\ #,##0.00",
  594. 495: "[$IQD]\\ #,##0.00",
  595. 496: "[$IRR]\\ #,##0.00",
  596. 497: "[$ISK]\\ #,##0.00",
  597. 498: "[$ITL]\\ #,##0.00",
  598. 499: "[$JMD]\\ #,##0.00",
  599. 500: "[$JOD]\\ #,##0.00",
  600. 501: "[$JPY]\\ #,##0.00",
  601. 502: "[$KAF]\\ #,##0.00",
  602. 503: "[$KES]\\ #,##0.00",
  603. 504: "[$KGS]\\ #,##0.00",
  604. 505: "[$KHR]\\ #,##0.00",
  605. 506: "[$KMF]\\ #,##0.00",
  606. 507: "[$KPW]\\ #,##0.00",
  607. 508: "[$KRW]\\ #,##0.00",
  608. 509: "[$KWD]\\ #,##0.00",
  609. 510: "[$KYD]\\ #,##0.00",
  610. 511: "[$KZT]\\ #,##0.00",
  611. 512: "[$LAK]\\ #,##0.00",
  612. 513: "[$LBP]\\ #,##0.00",
  613. 514: "[$LKR]\\ #,##0.00",
  614. 515: "[$LRD]\\ #,##0.00",
  615. 516: "[$LSL]\\ #,##0.00",
  616. 517: "[$LTL]\\ #,##0.00",
  617. 518: "[$LUF]\\ #,##0.00",
  618. 519: "[$LVL]\\ #,##0.00",
  619. 520: "[$LYD]\\ #,##0.00",
  620. 521: "[$MAD]\\ #,##0.00",
  621. 522: "[$MDL]\\ #,##0.00",
  622. 523: "[$MGA]\\ #,##0.00",
  623. 524: "[$MGF]\\ #,##0.00",
  624. 525: "[$MKD]\\ #,##0.00",
  625. 526: "[$MMK]\\ #,##0.00",
  626. 527: "[$MNT]\\ #,##0.00",
  627. 528: "[$MOP]\\ #,##0.00",
  628. 529: "[$MRO]\\ #,##0.00",
  629. 530: "[$MTL]\\ #,##0.00",
  630. 531: "[$MUR]\\ #,##0.00",
  631. 532: "[$MVR]\\ #,##0.00",
  632. 533: "[$MWK]\\ #,##0.00",
  633. 534: "[$MXN]\\ #,##0.00",
  634. 535: "[$MXV]\\ #,##0.00",
  635. 536: "[$MYR]\\ #,##0.00",
  636. 537: "[$MZM]\\ #,##0.00",
  637. 538: "[$MZN]\\ #,##0.00",
  638. 539: "[$NAD]\\ #,##0.00",
  639. 540: "[$NGN]\\ #,##0.00",
  640. 541: "[$NIO]\\ #,##0.00",
  641. 542: "[$NLG]\\ #,##0.00",
  642. 543: "[$NOK]\\ #,##0.00",
  643. 544: "[$NPR]\\ #,##0.00",
  644. 545: "[$NTD]\\ #,##0.00",
  645. 546: "[$NZD]\\ #,##0.00",
  646. 547: "[$OMR]\\ #,##0.00",
  647. 548: "[$PAB]\\ #,##0.00",
  648. 549: "[$PEN]\\ #,##0.00",
  649. 550: "[$PGK]\\ #,##0.00",
  650. 551: "[$PHP]\\ #,##0.00",
  651. 552: "[$PKR]\\ #,##0.00",
  652. 553: "[$PLN]\\ #,##0.00",
  653. 554: "[$PTE]\\ #,##0.00",
  654. 555: "[$PYG]\\ #,##0.00",
  655. 556: "[$QAR]\\ #,##0.00",
  656. 557: "[$ROL]\\ #,##0.00",
  657. 558: "[$RON]\\ #,##0.00",
  658. 559: "[$RSD]\\ #,##0.00",
  659. 560: "[$RUB]\\ #,##0.00",
  660. 561: "[$RUR]\\ #,##0.00",
  661. 562: "[$RWF]\\ #,##0.00",
  662. 563: "[$SAR]\\ #,##0.00",
  663. 564: "[$SBD]\\ #,##0.00",
  664. 565: "[$SCR]\\ #,##0.00",
  665. 566: "[$SDD]\\ #,##0.00",
  666. 567: "[$SDG]\\ #,##0.00",
  667. 568: "[$SDP]\\ #,##0.00",
  668. 569: "[$SEK]\\ #,##0.00",
  669. 570: "[$SGD]\\ #,##0.00",
  670. 571: "[$SHP]\\ #,##0.00",
  671. 572: "[$SIT]\\ #,##0.00",
  672. 573: "[$SKK]\\ #,##0.00",
  673. 574: "[$SLL]\\ #,##0.00",
  674. 575: "[$SOS]\\ #,##0.00",
  675. 576: "[$SPL]\\ #,##0.00",
  676. 577: "[$SRD]\\ #,##0.00",
  677. 578: "[$SRG]\\ #,##0.00",
  678. 579: "[$STD]\\ #,##0.00",
  679. 580: "[$SVC]\\ #,##0.00",
  680. 581: "[$SYP]\\ #,##0.00",
  681. 582: "[$SZL]\\ #,##0.00",
  682. 583: "[$THB]\\ #,##0.00",
  683. 584: "[$TJR]\\ #,##0.00",
  684. 585: "[$TJS]\\ #,##0.00",
  685. 586: "[$TMM]\\ #,##0.00",
  686. 587: "[$TMT]\\ #,##0.00",
  687. 588: "[$TND]\\ #,##0.00",
  688. 589: "[$TOP]\\ #,##0.00",
  689. 590: "[$TRL]\\ #,##0.00",
  690. 591: "[$TRY]\\ #,##0.00",
  691. 592: "[$TTD]\\ #,##0.00",
  692. 593: "[$TWD]\\ #,##0.00",
  693. 594: "[$TZS]\\ #,##0.00",
  694. 595: "[$UAH]\\ #,##0.00",
  695. 596: "[$UGX]\\ #,##0.00",
  696. 597: "[$USD]\\ #,##0.00",
  697. 598: "[$USN]\\ #,##0.00",
  698. 599: "[$USS]\\ #,##0.00",
  699. 600: "[$UYI]\\ #,##0.00",
  700. 601: "[$UYU]\\ #,##0.00",
  701. 602: "[$UZS]\\ #,##0.00",
  702. 603: "[$VEB]\\ #,##0.00",
  703. 604: "[$VEF]\\ #,##0.00",
  704. 605: "[$VND]\\ #,##0.00",
  705. 606: "[$VUV]\\ #,##0.00",
  706. 607: "[$WST]\\ #,##0.00",
  707. 608: "[$XAF]\\ #,##0.00",
  708. 609: "[$XAG]\\ #,##0.00",
  709. 610: "[$XAU]\\ #,##0.00",
  710. 611: "[$XB5]\\ #,##0.00",
  711. 612: "[$XBA]\\ #,##0.00",
  712. 613: "[$XBB]\\ #,##0.00",
  713. 614: "[$XBC]\\ #,##0.00",
  714. 615: "[$XBD]\\ #,##0.00",
  715. 616: "[$XCD]\\ #,##0.00",
  716. 617: "[$XDR]\\ #,##0.00",
  717. 618: "[$XFO]\\ #,##0.00",
  718. 619: "[$XFU]\\ #,##0.00",
  719. 620: "[$XOF]\\ #,##0.00",
  720. 621: "[$XPD]\\ #,##0.00",
  721. 622: "[$XPF]\\ #,##0.00",
  722. 623: "[$XPT]\\ #,##0.00",
  723. 624: "[$XTS]\\ #,##0.00",
  724. 625: "[$XXX]\\ #,##0.00",
  725. 626: "[$YER]\\ #,##0.00",
  726. 627: "[$YUM]\\ #,##0.00",
  727. 628: "[$ZAR]\\ #,##0.00",
  728. 629: "[$ZMK]\\ #,##0.00",
  729. 630: "[$ZMW]\\ #,##0.00",
  730. 631: "[$ZWD]\\ #,##0.00",
  731. 632: "[$ZWL]\\ #,##0.00",
  732. 633: "[$ZWN]\\ #,##0.00",
  733. 634: "[$ZWR]\\ #,##0.00",
  734. }
  735. // builtInNumFmtFunc defined the format conversion functions map. Partial format
  736. // code doesn't support currently and will return original string.
  737. var builtInNumFmtFunc = map[int]func(i int, v string) string{
  738. 0: formatToString,
  739. 1: formatToInt,
  740. 2: formatToFloat,
  741. 3: formatToInt,
  742. 4: formatToFloat,
  743. 9: formatToC,
  744. 10: formatToD,
  745. 11: formatToE,
  746. 12: formatToString, // Doesn't support currently
  747. 13: formatToString, // Doesn't support currently
  748. 14: parseTime,
  749. 15: parseTime,
  750. 16: parseTime,
  751. 17: parseTime,
  752. 18: parseTime,
  753. 19: parseTime,
  754. 20: parseTime,
  755. 21: parseTime,
  756. 22: parseTime,
  757. 37: formatToA,
  758. 38: formatToA,
  759. 39: formatToB,
  760. 40: formatToB,
  761. 41: formatToString, // Doesn't support currently
  762. 42: formatToString, // Doesn't support currently
  763. 43: formatToString, // Doesn't support currently
  764. 44: formatToString, // Doesn't support currently
  765. 45: parseTime,
  766. 46: parseTime,
  767. 47: parseTime,
  768. 48: formatToE,
  769. 49: formatToString,
  770. }
  771. // validType defined the list of valid validation types.
  772. var validType = map[string]string{
  773. "cell": "cellIs",
  774. "date": "date", // Doesn't support currently
  775. "time": "time", // Doesn't support currently
  776. "average": "aboveAverage",
  777. "duplicate": "duplicateValues",
  778. "unique": "uniqueValues",
  779. "top": "top10",
  780. "bottom": "top10",
  781. "text": "text", // Doesn't support currently
  782. "time_period": "timePeriod", // Doesn't support currently
  783. "blanks": "containsBlanks", // Doesn't support currently
  784. "no_blanks": "notContainsBlanks", // Doesn't support currently
  785. "errors": "containsErrors", // Doesn't support currently
  786. "no_errors": "notContainsErrors", // Doesn't support currently
  787. "2_color_scale": "2_color_scale",
  788. "3_color_scale": "3_color_scale",
  789. "data_bar": "dataBar",
  790. "formula": "expression",
  791. }
  792. // criteriaType defined the list of valid criteria types.
  793. var criteriaType = map[string]string{
  794. "between": "between",
  795. "not between": "notBetween",
  796. "equal to": "equal",
  797. "=": "equal",
  798. "==": "equal",
  799. "not equal to": "notEqual",
  800. "!=": "notEqual",
  801. "<>": "notEqual",
  802. "greater than": "greaterThan",
  803. ">": "greaterThan",
  804. "less than": "lessThan",
  805. "<": "lessThan",
  806. "greater than or equal to": "greaterThanOrEqual",
  807. ">=": "greaterThanOrEqual",
  808. "less than or equal to": "lessThanOrEqual",
  809. "<=": "lessThanOrEqual",
  810. "containing": "containsText",
  811. "not containing": "notContains",
  812. "begins with": "beginsWith",
  813. "ends with": "endsWith",
  814. "yesterday": "yesterday",
  815. "today": "today",
  816. "last 7 days": "last7Days",
  817. "last week": "lastWeek",
  818. "this week": "thisWeek",
  819. "continue week": "continueWeek",
  820. "last month": "lastMonth",
  821. "this month": "thisMonth",
  822. "continue month": "continueMonth",
  823. }
  824. // formatToString provides function to return original string by given built-in
  825. // number formats code and cell string.
  826. func formatToString(i int, v string) string {
  827. return v
  828. }
  829. // formatToInt provides function to convert original string to integer format as
  830. // string type by given built-in number formats code and cell string.
  831. func formatToInt(i int, v string) string {
  832. f, err := strconv.ParseFloat(v, 64)
  833. if err != nil {
  834. return v
  835. }
  836. return fmt.Sprintf("%d", int(f))
  837. }
  838. // formatToFloat provides function to convert original string to float format as
  839. // string type by given built-in number formats code and cell string.
  840. func formatToFloat(i int, v string) string {
  841. f, err := strconv.ParseFloat(v, 64)
  842. if err != nil {
  843. return v
  844. }
  845. return fmt.Sprintf("%.2f", f)
  846. }
  847. // formatToA provides function to convert original string to special format as
  848. // string type by given built-in number formats code and cell string.
  849. func formatToA(i int, v string) string {
  850. f, err := strconv.ParseFloat(v, 64)
  851. if err != nil {
  852. return v
  853. }
  854. if f < 0 {
  855. t := int(math.Abs(f))
  856. return fmt.Sprintf("(%d)", t)
  857. }
  858. t := int(f)
  859. return fmt.Sprintf("%d", t)
  860. }
  861. // formatToB provides function to convert original string to special format as
  862. // string type by given built-in number formats code and cell string.
  863. func formatToB(i int, v string) string {
  864. f, err := strconv.ParseFloat(v, 64)
  865. if err != nil {
  866. return v
  867. }
  868. if f < 0 {
  869. return fmt.Sprintf("(%.2f)", f)
  870. }
  871. return fmt.Sprintf("%.2f", f)
  872. }
  873. // formatToC provides function to convert original string to special format as
  874. // string type by given built-in number formats code and cell string.
  875. func formatToC(i int, v string) string {
  876. f, err := strconv.ParseFloat(v, 64)
  877. if err != nil {
  878. return v
  879. }
  880. f = f * 100
  881. return fmt.Sprintf("%d%%", int(f))
  882. }
  883. // formatToD provides function to convert original string to special format as
  884. // string type by given built-in number formats code and cell string.
  885. func formatToD(i int, v string) string {
  886. f, err := strconv.ParseFloat(v, 64)
  887. if err != nil {
  888. return v
  889. }
  890. f = f * 100
  891. return fmt.Sprintf("%.2f%%", f)
  892. }
  893. // formatToE provides function to convert original string to special format as
  894. // string type by given built-in number formats code and cell string.
  895. func formatToE(i int, v string) string {
  896. f, err := strconv.ParseFloat(v, 64)
  897. if err != nil {
  898. return v
  899. }
  900. return fmt.Sprintf("%.e", f)
  901. }
  902. // parseTime provides function to returns a string parsed using time.Time.
  903. // Replace Excel placeholders with Go time placeholders. For example, replace
  904. // yyyy with 2006. These are in a specific order, due to the fact that m is used
  905. // in month, minute, and am/pm. It would be easier to fix that with regular
  906. // expressions, but if it's possible to keep this simple it would be easier to
  907. // maintain. Full-length month and days (e.g. March, Tuesday) have letters in
  908. // them that would be replaced by other characters below (such as the 'h' in
  909. // March, or the 'd' in Tuesday) below. First we convert them to arbitrary
  910. // characters unused in Excel Date formats, and then at the end, turn them to
  911. // what they should actually be.
  912. // Based off: http://www.ozgrid.com/Excel/CustomFormats.htm
  913. func parseTime(i int, v string) string {
  914. f, err := strconv.ParseFloat(v, 64)
  915. if err != nil {
  916. return v
  917. }
  918. val := timeFromExcelTime(f, false)
  919. format := builtInNumFmt[i]
  920. replacements := []struct{ xltime, gotime string }{
  921. {"yyyy", "2006"},
  922. {"yy", "06"},
  923. {"mmmm", "%%%%"},
  924. {"dddd", "&&&&"},
  925. {"dd", "02"},
  926. {"d", "2"},
  927. {"mmm", "Jan"},
  928. {"mmss", "0405"},
  929. {"ss", "05"},
  930. {"mm:", "04:"},
  931. {":mm", ":04"},
  932. {"mm", "01"},
  933. {"am/pm", "pm"},
  934. {"m/", "1/"},
  935. {"%%%%", "January"},
  936. {"&&&&", "Monday"},
  937. }
  938. // It is the presence of the "am/pm" indicator that determines if this is
  939. // a 12 hour or 24 hours time format, not the number of 'h' characters.
  940. if is12HourTime(format) {
  941. format = strings.Replace(format, "hh", "03", 1)
  942. format = strings.Replace(format, "h", "3", 1)
  943. } else {
  944. format = strings.Replace(format, "hh", "15", 1)
  945. format = strings.Replace(format, "h", "15", 1)
  946. }
  947. for _, repl := range replacements {
  948. format = strings.Replace(format, repl.xltime, repl.gotime, 1)
  949. }
  950. // If the hour is optional, strip it out, along with the possible dangling
  951. // colon that would remain.
  952. if val.Hour() < 1 {
  953. format = strings.Replace(format, "]:", "]", 1)
  954. format = strings.Replace(format, "[03]", "", 1)
  955. format = strings.Replace(format, "[3]", "", 1)
  956. format = strings.Replace(format, "[15]", "", 1)
  957. } else {
  958. format = strings.Replace(format, "[3]", "3", 1)
  959. format = strings.Replace(format, "[15]", "15", 1)
  960. }
  961. return val.Format(format)
  962. }
  963. // is12HourTime checks whether an Excel time format string is a 12 hours form.
  964. func is12HourTime(format string) bool {
  965. return strings.Contains(format, "am/pm") || strings.Contains(format, "AM/PM") || strings.Contains(format, "a/p") || strings.Contains(format, "A/P")
  966. }
  967. // stylesReader provides function to get the pointer to the structure after
  968. // deserialization of xl/styles.xml.
  969. func (f *File) stylesReader() *xlsxStyleSheet {
  970. if f.Styles == nil {
  971. var styleSheet xlsxStyleSheet
  972. xml.Unmarshal([]byte(f.readXML("xl/styles.xml")), &styleSheet)
  973. f.Styles = &styleSheet
  974. }
  975. return f.Styles
  976. }
  977. // styleSheetWriter provides function to save xl/styles.xml after serialize
  978. // structure.
  979. func (f *File) styleSheetWriter() {
  980. if f.Styles != nil {
  981. output, _ := xml.Marshal(f.Styles)
  982. f.saveFileList("xl/styles.xml", replaceWorkSheetsRelationshipsNameSpace(string(output)))
  983. }
  984. }
  985. // parseFormatStyleSet provides function to parse the format settings of the
  986. // cells and conditional formats.
  987. func parseFormatStyleSet(style string) (*formatStyle, error) {
  988. format := formatStyle{
  989. DecimalPlaces: 2,
  990. }
  991. err := json.Unmarshal([]byte(style), &format)
  992. return &format, err
  993. }
  994. // NewStyle provides function to create style for cells by given style format.
  995. // Note that the color field uses RGB color code.
  996. //
  997. // The following shows the border styles sorted by excelize index number:
  998. //
  999. // Index | Name | Weight | Style
  1000. // -------+---------------+--------+-------------
  1001. // 0 | None | 0 |
  1002. // 1 | Continuous | 1 | -----------
  1003. // 2 | Continuous | 2 | -----------
  1004. // 3 | Dash | 1 | - - - - - -
  1005. // 4 | Dot | 1 | . . . . . .
  1006. // 5 | Continuous | 3 | -----------
  1007. // 6 | Double | 3 | ===========
  1008. // 7 | Continuous | 0 | -----------
  1009. // 8 | Dash | 2 | - - - - - -
  1010. // 9 | Dash Dot | 1 | - . - . - .
  1011. // 10 | Dash Dot | 2 | - . - . - .
  1012. // 11 | Dash Dot Dot | 1 | - . . - . .
  1013. // 12 | Dash Dot Dot | 2 | - . . - . .
  1014. // 13 | SlantDash Dot | 2 | / - . / - .
  1015. //
  1016. // The following shows the borders in the order shown in the Excel dialog:
  1017. //
  1018. // Index | Style | Index | Style
  1019. // -------+-------------+-------+-------------
  1020. // 0 | None | 12 | - . . - . .
  1021. // 7 | ----------- | 13 | / - . / - .
  1022. // 4 | . . . . . . | 10 | - . - . - .
  1023. // 11 | - . . - . . | 8 | - - - - - -
  1024. // 9 | - . - . - . | 2 | -----------
  1025. // 3 | - - - - - - | 5 | -----------
  1026. // 1 | ----------- | 6 | ===========
  1027. //
  1028. // The following shows the shading styles sorted by excelize index number:
  1029. //
  1030. // Index | Style | Index | Style
  1031. // -------+-----------------+-------+-----------------
  1032. // 0 | Horizontal | 3 | Diagonal down
  1033. // 1 | Vertical | 4 | From corner
  1034. // 2 | Diagonal Up | 5 | From center
  1035. //
  1036. // The following shows the patterns styles sorted by excelize index number:
  1037. //
  1038. // Index | Style | Index | Style
  1039. // -------+-----------------+-------+-----------------
  1040. // 0 | None | 10 | darkTrellis
  1041. // 1 | solid | 11 | lightHorizontal
  1042. // 2 | mediumGray | 12 | lightVertical
  1043. // 3 | darkGray | 13 | lightDown
  1044. // 4 | lightGray | 14 | lightUp
  1045. // 5 | darkHorizontal | 15 | lightGrid
  1046. // 6 | darkVertical | 16 | lightTrellis
  1047. // 7 | darkDown | 17 | gray125
  1048. // 8 | darkUp | 18 | gray0625
  1049. // 9 | darkGrid | |
  1050. //
  1051. // The following the type of horizontal alignment in cells:
  1052. //
  1053. // Style
  1054. // ------------------
  1055. // left
  1056. // center
  1057. // right
  1058. // fill
  1059. // justify
  1060. // centerContinuous
  1061. // distributed
  1062. //
  1063. // The following the type of vertical alignment in cells:
  1064. //
  1065. // Style
  1066. // ------------------
  1067. // top
  1068. // center
  1069. // justify
  1070. // distributed
  1071. //
  1072. // The following the type of font underline style:
  1073. //
  1074. // Style
  1075. // ------------------
  1076. // single
  1077. // double
  1078. //
  1079. // Excel's built-in all languages formats are shown in the following table:
  1080. //
  1081. // Index | Format String
  1082. // -------+----------------------------------------------------
  1083. // 0 | General
  1084. // 1 | 0
  1085. // 2 | 0.00
  1086. // 3 | #,##0
  1087. // 4 | #,##0.00
  1088. // 5 | ($#,##0_);($#,##0)
  1089. // 6 | ($#,##0_);[Red]($#,##0)
  1090. // 7 | ($#,##0.00_);($#,##0.00)
  1091. // 8 | ($#,##0.00_);[Red]($#,##0.00)
  1092. // 9 | 0%
  1093. // 10 | 0.00%
  1094. // 11 | 0.00E+00
  1095. // 12 | # ?/?
  1096. // 13 | # ??/??
  1097. // 14 | m/d/yy
  1098. // 15 | d-mmm-yy
  1099. // 16 | d-mmm
  1100. // 17 | mmm-yy
  1101. // 18 | h:mm AM/PM
  1102. // 19 | h:mm:ss AM/PM
  1103. // 20 | h:mm
  1104. // 21 | h:mm:ss
  1105. // 22 | m/d/yy h:mm
  1106. // ... | ...
  1107. // 37 | (#,##0_);(#,##0)
  1108. // 38 | (#,##0_);[Red](#,##0)
  1109. // 39 | (#,##0.00_);(#,##0.00)
  1110. // 40 | (#,##0.00_);[Red](#,##0.00)
  1111. // 41 | _(* #,##0_);_(* (#,##0);_(* "-"_);_(@_)
  1112. // 42 | _($* #,##0_);_($* (#,##0);_($* "-"_);_(@_)
  1113. // 43 | _(* #,##0.00_);_(* (#,##0.00);_(* "-"??_);_(@_)
  1114. // 44 | _($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)
  1115. // 45 | mm:ss
  1116. // 46 | [h]:mm:ss
  1117. // 47 | mm:ss.0
  1118. // 48 | ##0.0E+0
  1119. // 49 | @
  1120. //
  1121. // Number format code in zh-tw language:
  1122. //
  1123. // Index | Symbol
  1124. // -------+-------------------------------------------
  1125. // 27 | [$-404]e/m/d
  1126. // 28 | [$-404]e"年"m"月"d"日"
  1127. // 29 | [$-404]e"年"m"月"d"日"
  1128. // 30 | m/d/yy
  1129. // 31 | yyyy"年"m"月"d"日"
  1130. // 32 | hh"時"mm"分"
  1131. // 33 | hh"時"mm"分"ss"秒"
  1132. // 34 | 上午/下午 hh"時"mm"分"
  1133. // 35 | 上午/下午 hh"時"mm"分"ss"秒"
  1134. // 36 | [$-404]e/m/d
  1135. // 50 | [$-404]e/m/d
  1136. // 51 | [$-404]e"年"m"月"d"日"
  1137. // 52 | 上午/下午 hh"時"mm"分"
  1138. // 53 | 上午/下午 hh"時"mm"分"ss"秒"
  1139. // 54 | [$-404]e"年"m"月"d"日"
  1140. // 55 | 上午/下午 hh"時"mm"分"
  1141. // 56 | 上午/下午 hh"時"mm"分"ss"秒"
  1142. // 57 | [$-404]e/m/d
  1143. // 58 | [$-404]e"年"m"月"d"日"
  1144. //
  1145. // Number format code in zh-cn language:
  1146. //
  1147. // Index | Symbol
  1148. // -------+-------------------------------------------
  1149. // 27 | yyyy"年"m"月"
  1150. // 28 | m"月"d"日"
  1151. // 29 | m"月"d"日"
  1152. // 30 | m-d-yy
  1153. // 31 | yyyy"年"m"月"d"日"
  1154. // 32 | h"时"mm"分"
  1155. // 33 | h"时"mm"分"ss"秒"
  1156. // 34 | 上午/下午 h"时"mm"分"
  1157. // 35 | 上午/下午 h"时"mm"分"ss"秒
  1158. // 36 | yyyy"年"m"月
  1159. // 50 | yyyy"年"m"月
  1160. // 51 | m"月"d"日
  1161. // 52 | yyyy"年"m"月
  1162. // 53 | m"月"d"日
  1163. // 54 | m"月"d"日
  1164. // 55 | 上午/下午 h"时"mm"分
  1165. // 56 | 上午/下午 h"时"mm"分"ss"秒
  1166. // 57 | yyyy"年"m"月
  1167. // 58 | m"月"d"日"
  1168. //
  1169. // Number format code with unicode values provided for language glyphs where
  1170. // they occur in zh-tw language:
  1171. //
  1172. // Index | Symbol
  1173. // -------+-------------------------------------------
  1174. // 27 | [$-404]e/m/
  1175. // 28 | [$-404]e"5E74"m"6708"d"65E5
  1176. // 29 | [$-404]e"5E74"m"6708"d"65E5
  1177. // 30 | m/d/y
  1178. // 31 | yyyy"5E74"m"6708"d"65E5
  1179. // 32 | hh"6642"mm"5206
  1180. // 33 | hh"6642"mm"5206"ss"79D2
  1181. // 34 | 4E0A5348/4E0B5348hh"6642"mm"5206
  1182. // 35 | 4E0A5348/4E0B5348hh"6642"mm"5206"ss"79D2
  1183. // 36 | [$-404]e/m/
  1184. // 50 | [$-404]e/m/
  1185. // 51 | [$-404]e"5E74"m"6708"d"65E5
  1186. // 52 | 4E0A5348/4E0B5348hh"6642"mm"5206
  1187. // 53 | 4E0A5348/4E0B5348hh"6642"mm"5206"ss"79D2
  1188. // 54 | [$-404]e"5E74"m"6708"d"65E5
  1189. // 55 | 4E0A5348/4E0B5348hh"6642"mm"5206
  1190. // 56 | 4E0A5348/4E0B5348hh"6642"mm"5206"ss"79D2
  1191. // 57 | [$-404]e/m/
  1192. // 58 | [$-404]e"5E74"m"6708"d"65E5"
  1193. //
  1194. // Number format code with unicode values provided for language glyphs where
  1195. // they occur in zh-cn language:
  1196. //
  1197. // Index | Symbol
  1198. // -------+-------------------------------------------
  1199. // 27 | yyyy"5E74"m"6708
  1200. // 28 | m"6708"d"65E5
  1201. // 29 | m"6708"d"65E5
  1202. // 30 | m-d-y
  1203. // 31 | yyyy"5E74"m"6708"d"65E5
  1204. // 32 | h"65F6"mm"5206
  1205. // 33 | h"65F6"mm"5206"ss"79D2
  1206. // 34 | 4E0A5348/4E0B5348h"65F6"mm"5206
  1207. // 35 | 4E0A5348/4E0B5348h"65F6"mm"5206"ss"79D2
  1208. // 36 | yyyy"5E74"m"6708
  1209. // 50 | yyyy"5E74"m"6708
  1210. // 51 | m"6708"d"65E5
  1211. // 52 | yyyy"5E74"m"6708
  1212. // 53 | m"6708"d"65E5
  1213. // 54 | m"6708"d"65E5
  1214. // 55 | 4E0A5348/4E0B5348h"65F6"mm"5206
  1215. // 56 | 4E0A5348/4E0B5348h"65F6"mm"5206"ss"79D2
  1216. // 57 | yyyy"5E74"m"6708
  1217. // 58 | m"6708"d"65E5"`,
  1218. //
  1219. // Number format code in ja-jp language:
  1220. //
  1221. // Index | Symbol
  1222. // -------+-------------------------------------------
  1223. // 27 | [$-411]ge.m.
  1224. // 28 | [$-411]ggge"年"m"月"d"日
  1225. // 29 | [$-411]ggge"年"m"月"d"日
  1226. // 30 | m/d/y
  1227. // 31 | yyyy"年"m"月"d"日
  1228. // 32 | h"時"mm"分
  1229. // 33 | h"時"mm"分"ss"秒
  1230. // 34 | yyyy"年"m"月
  1231. // 35 | m"月"d"日
  1232. // 36 | [$-411]ge.m.
  1233. // 50 | [$-411]ge.m.
  1234. // 51 | [$-411]ggge"年"m"月"d"日
  1235. // 52 | yyyy"年"m"月
  1236. // 53 | m"月"d"日
  1237. // 54 | [$-411]ggge"年"m"月"d"日
  1238. // 55 | yyyy"年"m"月
  1239. // 56 | m"月"d"日
  1240. // 57 | [$-411]ge.m.
  1241. // 58 | [$-411]ggge"年"m"月"d"日"
  1242. //
  1243. // Number format code in th-th language:
  1244. //
  1245. // Index | Symbol
  1246. // -------+-------------------------------------------
  1247. // 27 | yyyy"年" mm"月" dd"日
  1248. // 28 | mm-d
  1249. // 29 | mm-d
  1250. // 30 | mm-dd-y
  1251. // 31 | yyyy"년" mm"월" dd"일
  1252. // 32 | h"시" mm"분
  1253. // 33 | h"시" mm"분" ss"초
  1254. // 34 | yyyy-mm-d
  1255. // 35 | yyyy-mm-d
  1256. // 36 | yyyy"年" mm"月" dd"日
  1257. // 50 | yyyy"年" mm"月" dd"日
  1258. // 51 | mm-d
  1259. // 52 | yyyy-mm-d
  1260. // 53 | yyyy-mm-d
  1261. // 54 | mm-d
  1262. // 55 | yyyy-mm-d
  1263. // 56 | yyyy-mm-d
  1264. // 57 | yyyy"年" mm"月" dd"日
  1265. // 58 | mm-dd
  1266. //
  1267. // Number format code with unicode values provided for language glyphs where
  1268. // they occur in ja-jp language:
  1269. //
  1270. // Index | Symbol
  1271. // -------+-------------------------------------------
  1272. // 27 | [$-411]ge.m.
  1273. // 28 | [$-411]ggge"5E74"m"6708"d"65E5
  1274. // 29 | [$-411]ggge"5E74"m"6708"d"65E5
  1275. // 30 | m/d/y
  1276. // 31 | yyyy"5E74"m"6708"d"65E5
  1277. // 32 | h"6642"mm"5206
  1278. // 33 | h"6642"mm"5206"ss"79D2
  1279. // 34 | yyyy"5E74"m"6708
  1280. // 35 | m"6708"d"65E5
  1281. // 36 | [$-411]ge.m.
  1282. // 50 | [$-411]ge.m.
  1283. // 51 | [$-411]ggge"5E74"m"6708"d"65E5
  1284. // 52 | yyyy"5E74"m"6708
  1285. // 53 | m"6708"d"65E5
  1286. // 54 | [$-411]ggge"5E74"m"6708"d"65E5
  1287. // 55 | yyyy"5E74"m"6708
  1288. // 56 | m"6708"d"65E5
  1289. // 57 | [$-411]ge.m.
  1290. // 58 | [$-411]ggge"5E74"m"6708"d"65E5"
  1291. //
  1292. // Number format code with unicode values provided for language glyphs where
  1293. // they occur in ko-kr language:
  1294. //
  1295. // Index | Symbol
  1296. // -------+-------------------------------------------
  1297. // 27 | yyyy"5E74" mm"6708" dd"65E5
  1298. // 28 | mm-d
  1299. // 29 | mm-d
  1300. // 30 | mm-dd-y
  1301. // 31 | yyyy"B144" mm"C6D4" dd"C77C
  1302. // 32 | h"C2DC" mm"BD84
  1303. // 33 | h"C2DC" mm"BD84" ss"CD08
  1304. // 34 | yyyy-mm-d
  1305. // 35 | yyyy-mm-d
  1306. // 36 | yyyy"5E74" mm"6708" dd"65E5
  1307. // 50 | yyyy"5E74" mm"6708" dd"65E5
  1308. // 51 | mm-d
  1309. // 52 | yyyy-mm-d
  1310. // 53 | yyyy-mm-d
  1311. // 54 | mm-d
  1312. // 55 | yyyy-mm-d
  1313. // 56 | yyyy-mm-d
  1314. // 57 | yyyy"5E74" mm"6708" dd"65E5
  1315. // 58 | mm-dd
  1316. //
  1317. // Number format code in ko-kr language:
  1318. //
  1319. // Index | Symbol
  1320. // -------+-------------------------------------------
  1321. // 59 | t
  1322. // 60 | t0.0
  1323. // 61 | t#,##
  1324. // 62 | t#,##0.0
  1325. // 67 | t0
  1326. // 68 | t0.00
  1327. // 69 | t# ?/
  1328. // 70 | t# ??/?
  1329. // 71 | ว/ด/ปปป
  1330. // 72 | ว-ดดด-ป
  1331. // 73 | ว-ดด
  1332. // 74 | ดดด-ป
  1333. // 75 | ช:น
  1334. // 76 | ช:นน:ท
  1335. // 77 | ว/ด/ปปปป ช:น
  1336. // 78 | นน:ท
  1337. // 79 | [ช]:นน:ท
  1338. // 80 | นน:ทท.
  1339. // 81 | d/m/bb
  1340. //
  1341. // Number format code with unicode values provided for language glyphs where
  1342. // they occur in th-th language:
  1343. //
  1344. // Index | Symbol
  1345. // -------+-------------------------------------------
  1346. // 59 | t
  1347. // 60 | t0.0
  1348. // 61 | t#,##
  1349. // 62 | t#,##0.0
  1350. // 67 | t0
  1351. // 68 | t0.00
  1352. // 69 | t# ?/
  1353. // 70 | t# ??/?
  1354. // 71 | 0E27/0E14/0E1B0E1B0E1B0E1
  1355. // 72 | 0E27-0E140E140E14-0E1B0E1
  1356. // 73 | 0E27-0E140E140E1
  1357. // 74 | 0E140E140E14-0E1B0E1
  1358. // 75 | 0E0A:0E190E1
  1359. // 76 | 0E0A:0E190E19:0E170E1
  1360. // 77 | 0E27/0E14/0E1B0E1B0E1B0E1B 0E0A:0E190E1
  1361. // 78 | 0E190E19:0E170E1
  1362. // 79 | [0E0A]:0E190E19:0E170E1
  1363. // 80 | 0E190E19:0E170E17.
  1364. // 81 | d/m/bb
  1365. //
  1366. // Excelize built-in currency formats are shown in the following table, only
  1367. // support these types in the following table (Index number is used only for
  1368. // markup and is not used inside an Excel file and you can't get formatted value
  1369. // by the function GetCellValue) currently:
  1370. //
  1371. // Index | Symbol
  1372. // -------+---------------------------------------------------------------
  1373. // 164 | CN¥
  1374. // 165 | $ English (China)
  1375. // 166 | $ Cherokee (United States)
  1376. // 167 | $ Chinese (Singapore)
  1377. // 168 | $ Chinese (Taiwan)
  1378. // 169 | $ English (Australia)
  1379. // 170 | $ English (Belize)
  1380. // 171 | $ English (Canada)
  1381. // 172 | $ English (Jamaica)
  1382. // 173 | $ English (New Zealand)
  1383. // 174 | $ English (Singapore)
  1384. // 175 | $ English (Trinidad & Tobago)
  1385. // 176 | $ English (U.S. Vigin Islands)
  1386. // 177 | $ English (United States)
  1387. // 178 | $ French (Canada)
  1388. // 179 | $ Hawaiian (United States)
  1389. // 180 | $ Malay (Brunei)
  1390. // 181 | $ Quechua (Ecuador)
  1391. // 182 | $ Spanish (Chile)
  1392. // 183 | $ Spanish (Colombia)
  1393. // 184 | $ Spanish (Ecuador)
  1394. // 185 | $ Spanish (El Salvador)
  1395. // 186 | $ Spanish (Mexico)
  1396. // 187 | $ Spanish (Puerto Rico)
  1397. // 188 | $ Spanish (United States)
  1398. // 189 | $ Spanish (Uruguay)
  1399. // 190 | £ English (United Kingdom)
  1400. // 191 | £ Scottish Gaelic (United Kingdom)
  1401. // 192 | £ Welsh (United Kindom)
  1402. // 193 | ¥ Chinese (China)
  1403. // 194 | ¥ Japanese (Japan)
  1404. // 195 | ¥ Sichuan Yi (China)
  1405. // 196 | ¥ Tibetan (China)
  1406. // 197 | ¥ Uyghur (China)
  1407. // 198 | ֏ Armenian (Armenia)
  1408. // 199 | ؋ Pashto (Afghanistan)
  1409. // 200 | ؋ Persian (Afghanistan)
  1410. // 201 | ৳ Bengali (Bangladesh)
  1411. // 202 | ៛ Khmer (Cambodia)
  1412. // 203 | ₡ Spanish (Costa Rica)
  1413. // 204 | ₦ Hausa (Nigeria)
  1414. // 205 | ₦ Igbo (Nigeria)
  1415. // 206 | ₦ Yoruba (Nigeria)
  1416. // 207 | ₩ Korean (South Korea)
  1417. // 208 | ₪ Hebrew (Israel)
  1418. // 209 | ₫ Vietnamese (Vietnam)
  1419. // 210 | € Basque (Spain)
  1420. // 211 | € Breton (France)
  1421. // 212 | € Catalan (Spain)
  1422. // 213 | € Corsican (France)
  1423. // 214 | € Dutch (Belgium)
  1424. // 215 | € Dutch (Netherlands)
  1425. // 216 | € English (Ireland)
  1426. // 217 | € Estonian (Estonia)
  1427. // 218 | € Euro (€ 123)
  1428. // 219 | € Euro (123 €)
  1429. // 220 | € Finnish (Finland)
  1430. // 221 | € French (Belgium)
  1431. // 222 | € French (France)
  1432. // 223 | € French (Luxembourg)
  1433. // 224 | € French (Monaco)
  1434. // 225 | € French (Réunion)
  1435. // 226 | € Galician (Spain)
  1436. // 227 | € German (Austria)
  1437. // 228 | € German (Luxembourg)
  1438. // 229 | € Greek (Greece)
  1439. // 230 | € Inari Sami (Finland)
  1440. // 231 | € Irish (Ireland)
  1441. // 232 | € Italian (Italy)
  1442. // 233 | € Latin (Italy)
  1443. // 234 | € Latin, Serbian (Montenegro)
  1444. // 235 | € Larvian (Latvia)
  1445. // 236 | € Lithuanian (Lithuania)
  1446. // 237 | € Lower Sorbian (Germany)
  1447. // 238 | € Luxembourgish (Luxembourg)
  1448. // 239 | € Maltese (Malta)
  1449. // 240 | € Northern Sami (Finland)
  1450. // 241 | € Occitan (France)
  1451. // 242 | € Portuguese (Portugal)
  1452. // 243 | € Serbian (Montenegro)
  1453. // 244 | € Skolt Sami (Finland)
  1454. // 245 | € Slovak (Slovakia)
  1455. // 246 | € Slovenian (Slovenia)
  1456. // 247 | € Spanish (Spain)
  1457. // 248 | € Swedish (Finland)
  1458. // 249 | € Swiss German (France)
  1459. // 250 | € Upper Sorbian (Germany)
  1460. // 251 | € Western Frisian (Netherlands)
  1461. // 252 | ₭ Lao (Laos)
  1462. // 253 | ₮ Mongolian (Mongolia)
  1463. // 254 | ₮ Mongolian, Mongolian (Mongolia)
  1464. // 255 | ₱ English (Philippines)
  1465. // 256 | ₱ Filipino (Philippines)
  1466. // 257 | ₴ Ukrainian (Ukraine)
  1467. // 258 | ₸ Kazakh (Kazakhstan)
  1468. // 259 | ₹ Arabic, Kashmiri (India)
  1469. // 260 | ₹ English (India)
  1470. // 261 | ₹ Gujarati (India)
  1471. // 262 | ₹ Hindi (India)
  1472. // 263 | ₹ Kannada (India)
  1473. // 264 | ₹ Kashmiri (India)
  1474. // 265 | ₹ Konkani (India)
  1475. // 266 | ₹ Manipuri (India)
  1476. // 267 | ₹ Marathi (India)
  1477. // 268 | ₹ Nepali (India)
  1478. // 269 | ₹ Oriya (India)
  1479. // 270 | ₹ Punjabi (India)
  1480. // 271 | ₹ Sanskrit (India)
  1481. // 272 | ₹ Sindhi (India)
  1482. // 273 | ₹ Tamil (India)
  1483. // 274 | ₹ Urdu (India)
  1484. // 275 | ₺ Turkish (Turkey)
  1485. // 276 | ₼ Azerbaijani (Azerbaijan)
  1486. // 277 | ₼ Cyrillic, Azerbaijani (Azerbaijan)
  1487. // 278 | ₽ Russian (Russia)
  1488. // 279 | ₽ Sakha (Russia)
  1489. // 280 | ₾ Georgian (Georgia)
  1490. // 281 | B/. Spanish (Panama)
  1491. // 282 | Br Oromo (Ethiopia)
  1492. // 283 | Br Somali (Ethiopia)
  1493. // 284 | Br Tigrinya (Ethiopia)
  1494. // 285 | Bs Quechua (Bolivia)
  1495. // 286 | Bs Spanish (Bolivia)
  1496. // 287 | BS. Spanish (Venezuela)
  1497. // 288 | BWP Tswana (Botswana)
  1498. // 289 | C$ Spanish (Nicaragua)
  1499. // 290 | CA$ Latin, Inuktitut (Canada)
  1500. // 291 | CA$ Mohawk (Canada)
  1501. // 292 | CA$ Unified Canadian Aboriginal Syllabics, Inuktitut (Canada)
  1502. // 293 | CFA French (Mali)
  1503. // 294 | CFA French (Senegal)
  1504. // 295 | CFA Fulah (Senegal)
  1505. // 296 | CFA Wolof (Senegal)
  1506. // 297 | CHF French (Switzerland)
  1507. // 298 | CHF German (Liechtenstein)
  1508. // 299 | CHF German (Switzerland)
  1509. // 300 | CHF Italian (Switzerland)
  1510. // 301 | CHF Romansh (Switzerland)
  1511. // 302 | CLP Mapuche (Chile)
  1512. // 303 | CN¥ Mongolian, Mongolian (China)
  1513. // 304 | DZD Central Atlas Tamazight (Algeria)
  1514. // 305 | FCFA French (Cameroon)
  1515. // 306 | Ft Hungarian (Hungary)
  1516. // 307 | G French (Haiti)
  1517. // 308 | Gs. Spanish (Paraguay)
  1518. // 309 | GTQ K'iche' (Guatemala)
  1519. // 310 | HK$ Chinese (Hong Kong (China))
  1520. // 311 | HK$ English (Hong Kong (China))
  1521. // 312 | HRK Croatian (Croatia)
  1522. // 313 | IDR English (Indonesia)
  1523. // 314 | IQD Arbic, Central Kurdish (Iraq)
  1524. // 315 | ISK Icelandic (Iceland)
  1525. // 316 | K Burmese (Myanmar (Burma))
  1526. // 317 | Kč Czech (Czech Republic)
  1527. // 318 | KM Bosnian (Bosnia & Herzegovina)
  1528. // 319 | KM Croatian (Bosnia & Herzegovina)
  1529. // 320 | KM Latin, Serbian (Bosnia & Herzegovina)
  1530. // 321 | kr Faroese (Faroe Islands)
  1531. // 322 | kr Northern Sami (Norway)
  1532. // 323 | kr Northern Sami (Sweden)
  1533. // 324 | kr Norwegian Bokmål (Norway)
  1534. // 325 | kr Norwegian Nynorsk (Norway)
  1535. // 326 | kr Swedish (Sweden)
  1536. // 327 | kr. Danish (Denmark)
  1537. // 328 | kr. Kalaallisut (Greenland)
  1538. // 329 | Ksh Swahili (kenya)
  1539. // 330 | L Romanian (Moldova)
  1540. // 331 | L Russian (Moldova)
  1541. // 332 | L Spanish (Honduras)
  1542. // 333 | Lekë Albanian (Albania)
  1543. // 334 | MAD Arabic, Central Atlas Tamazight (Morocco)
  1544. // 335 | MAD French (Morocco)
  1545. // 336 | MAD Tifinagh, Central Atlas Tamazight (Morocco)
  1546. // 337 | MOP$ Chinese (Macau (China))
  1547. // 338 | MVR Divehi (Maldives)
  1548. // 339 | Nfk Tigrinya (Eritrea)
  1549. // 340 | NGN Bini (Nigeria)
  1550. // 341 | NGN Fulah (Nigeria)
  1551. // 342 | NGN Ibibio (Nigeria)
  1552. // 343 | NGN Kanuri (Nigeria)
  1553. // 344 | NOK Lule Sami (Norway)
  1554. // 345 | NOK Southern Sami (Norway)
  1555. // 346 | NZ$ Maori (New Zealand)
  1556. // 347 | PKR Sindhi (Pakistan)
  1557. // 348 | PYG Guarani (Paraguay)
  1558. // 349 | Q Spanish (Guatemala)
  1559. // 350 | R Afrikaans (South Africa)
  1560. // 351 | R English (South Africa)
  1561. // 352 | R Zulu (South Africa)
  1562. // 353 | R$ Portuguese (Brazil)
  1563. // 354 | RD$ Spanish (Dominican Republic)
  1564. // 355 | RF Kinyarwanda (Rwanda)
  1565. // 356 | RM English (Malaysia)
  1566. // 357 | RM Malay (Malaysia)
  1567. // 358 | RON Romanian (Romania)
  1568. // 359 | Rp Indonesoan (Indonesia)
  1569. // 360 | Rs Urdu (Pakistan)
  1570. // 361 | Rs. Tamil (Sri Lanka)
  1571. // 362 | RSD Latin, Serbian (Serbia)
  1572. // 363 | RSD Serbian (Serbia)
  1573. // 364 | RUB Bashkir (Russia)
  1574. // 365 | RUB Tatar (Russia)
  1575. // 366 | S/. Quechua (Peru)
  1576. // 367 | S/. Spanish (Peru)
  1577. // 368 | SEK Lule Sami (Sweden)
  1578. // 369 | SEK Southern Sami (Sweden)
  1579. // 370 | soʻm Latin, Uzbek (Uzbekistan)
  1580. // 371 | soʻm Uzbek (Uzbekistan)
  1581. // 372 | SYP Syriac (Syria)
  1582. // 373 | THB Thai (Thailand)
  1583. // 374 | TMT Turkmen (Turkmenistan)
  1584. // 375 | US$ English (Zimbabwe)
  1585. // 376 | ZAR Northern Sotho (South Africa)
  1586. // 377 | ZAR Southern Sotho (South Africa)
  1587. // 378 | ZAR Tsonga (South Africa)
  1588. // 379 | ZAR Tswana (south Africa)
  1589. // 380 | ZAR Venda (South Africa)
  1590. // 381 | ZAR Xhosa (South Africa)
  1591. // 382 | zł Polish (Poland)
  1592. // 383 | ден Macedonian (Macedonia)
  1593. // 384 | KM Cyrillic, Bosnian (Bosnia & Herzegovina)
  1594. // 385 | KM Serbian (Bosnia & Herzegovina)
  1595. // 386 | лв. Bulgarian (Bulgaria)
  1596. // 387 | p. Belarusian (Belarus)
  1597. // 388 | сом Kyrgyz (Kyrgyzstan)
  1598. // 389 | сом Tajik (Tajikistan)
  1599. // 390 | ج.م. Arabic (Egypt)
  1600. // 391 | د.أ. Arabic (Jordan)
  1601. // 392 | د.أ. Arabic (United Arab Emirates)
  1602. // 393 | د.ب. Arabic (Bahrain)
  1603. // 394 | د.ت. Arabic (Tunisia)
  1604. // 395 | د.ج. Arabic (Algeria)
  1605. // 396 | د.ع. Arabic (Iraq)
  1606. // 397 | د.ك. Arabic (Kuwait)
  1607. // 398 | د.ل. Arabic (Libya)
  1608. // 399 | د.م. Arabic (Morocco)
  1609. // 400 | ر Punjabi (Pakistan)
  1610. // 401 | ر.س. Arabic (Saudi Arabia)
  1611. // 402 | ر.ع. Arabic (Oman)
  1612. // 403 | ر.ق. Arabic (Qatar)
  1613. // 404 | ر.ي. Arabic (Yemen)
  1614. // 405 | ریال Persian (Iran)
  1615. // 406 | ل.س. Arabic (Syria)
  1616. // 407 | ل.ل. Arabic (Lebanon)
  1617. // 408 | ብር Amharic (Ethiopia)
  1618. // 409 | रू Nepaol (Nepal)
  1619. // 410 | රු. Sinhala (Sri Lanka)
  1620. // 411 | ADP
  1621. // 412 | AED
  1622. // 413 | AFA
  1623. // 414 | AFN
  1624. // 415 | ALL
  1625. // 416 | AMD
  1626. // 417 | ANG
  1627. // 418 | AOA
  1628. // 419 | ARS
  1629. // 420 | ATS
  1630. // 421 | AUD
  1631. // 422 | AWG
  1632. // 423 | AZM
  1633. // 424 | AZN
  1634. // 425 | BAM
  1635. // 426 | BBD
  1636. // 427 | BDT
  1637. // 428 | BEF
  1638. // 429 | BGL
  1639. // 430 | BGN
  1640. // 431 | BHD
  1641. // 432 | BIF
  1642. // 433 | BMD
  1643. // 434 | BND
  1644. // 435 | BOB
  1645. // 436 | BOV
  1646. // 437 | BRL
  1647. // 438 | BSD
  1648. // 439 | BTN
  1649. // 440 | BWP
  1650. // 441 | BYR
  1651. // 442 | BZD
  1652. // 443 | CAD
  1653. // 444 | CDF
  1654. // 445 | CHE
  1655. // 446 | CHF
  1656. // 447 | CHW
  1657. // 448 | CLF
  1658. // 449 | CLP
  1659. // 450 | CNY
  1660. // 451 | COP
  1661. // 452 | COU
  1662. // 453 | CRC
  1663. // 454 | CSD
  1664. // 455 | CUC
  1665. // 456 | CVE
  1666. // 457 | CYP
  1667. // 458 | CZK
  1668. // 459 | DEM
  1669. // 460 | DJF
  1670. // 461 | DKK
  1671. // 462 | DOP
  1672. // 463 | DZD
  1673. // 464 | ECS
  1674. // 465 | ECV
  1675. // 466 | EEK
  1676. // 467 | EGP
  1677. // 468 | ERN
  1678. // 469 | ESP
  1679. // 470 | ETB
  1680. // 471 | EUR
  1681. // 472 | FIM
  1682. // 473 | FJD
  1683. // 474 | FKP
  1684. // 475 | FRF
  1685. // 476 | GBP
  1686. // 477 | GEL
  1687. // 478 | GHC
  1688. // 479 | GHS
  1689. // 480 | GIP
  1690. // 481 | GMD
  1691. // 482 | GNF
  1692. // 483 | GRD
  1693. // 484 | GTQ
  1694. // 485 | GYD
  1695. // 486 | HKD
  1696. // 487 | HNL
  1697. // 488 | HRK
  1698. // 489 | HTG
  1699. // 490 | HUF
  1700. // 491 | IDR
  1701. // 492 | IEP
  1702. // 493 | ILS
  1703. // 494 | INR
  1704. // 495 | IQD
  1705. // 496 | IRR
  1706. // 497 | ISK
  1707. // 498 | ITL
  1708. // 499 | JMD
  1709. // 500 | JOD
  1710. // 501 | JPY
  1711. // 502 | KAF
  1712. // 503 | KES
  1713. // 504 | KGS
  1714. // 505 | KHR
  1715. // 506 | KMF
  1716. // 507 | KPW
  1717. // 508 | KRW
  1718. // 509 | KWD
  1719. // 510 | KYD
  1720. // 511 | KZT
  1721. // 512 | LAK
  1722. // 513 | LBP
  1723. // 514 | LKR
  1724. // 515 | LRD
  1725. // 516 | LSL
  1726. // 517 | LTL
  1727. // 518 | LUF
  1728. // 519 | LVL
  1729. // 520 | LYD
  1730. // 521 | MAD
  1731. // 522 | MDL
  1732. // 523 | MGA
  1733. // 524 | MGF
  1734. // 525 | MKD
  1735. // 526 | MMK
  1736. // 527 | MNT
  1737. // 528 | MOP
  1738. // 529 | MRO
  1739. // 530 | MTL
  1740. // 531 | MUR
  1741. // 532 | MVR
  1742. // 533 | MWK
  1743. // 534 | MXN
  1744. // 535 | MXV
  1745. // 536 | MYR
  1746. // 537 | MZM
  1747. // 538 | MZN
  1748. // 539 | NAD
  1749. // 540 | NGN
  1750. // 541 | NIO
  1751. // 542 | NLG
  1752. // 543 | NOK
  1753. // 544 | NPR
  1754. // 545 | NTD
  1755. // 546 | NZD
  1756. // 547 | OMR
  1757. // 548 | PAB
  1758. // 549 | PEN
  1759. // 550 | PGK
  1760. // 551 | PHP
  1761. // 552 | PKR
  1762. // 553 | PLN
  1763. // 554 | PTE
  1764. // 555 | PYG
  1765. // 556 | QAR
  1766. // 557 | ROL
  1767. // 558 | RON
  1768. // 559 | RSD
  1769. // 560 | RUB
  1770. // 561 | RUR
  1771. // 562 | RWF
  1772. // 563 | SAR
  1773. // 564 | SBD
  1774. // 565 | SCR
  1775. // 566 | SDD
  1776. // 567 | SDG
  1777. // 568 | SDP
  1778. // 569 | SEK
  1779. // 570 | SGD
  1780. // 571 | SHP
  1781. // 572 | SIT
  1782. // 573 | SKK
  1783. // 574 | SLL
  1784. // 575 | SOS
  1785. // 576 | SPL
  1786. // 577 | SRD
  1787. // 578 | SRG
  1788. // 579 | STD
  1789. // 580 | SVC
  1790. // 581 | SYP
  1791. // 582 | SZL
  1792. // 583 | THB
  1793. // 584 | TJR
  1794. // 585 | TJS
  1795. // 586 | TMM
  1796. // 587 | TMT
  1797. // 588 | TND
  1798. // 589 | TOP
  1799. // 590 | TRL
  1800. // 591 | TRY
  1801. // 592 | TTD
  1802. // 593 | TWD
  1803. // 594 | TZS
  1804. // 595 | UAH
  1805. // 596 | UGX
  1806. // 597 | USD
  1807. // 598 | USN
  1808. // 599 | USS
  1809. // 600 | UYI
  1810. // 601 | UYU
  1811. // 602 | UZS
  1812. // 603 | VEB
  1813. // 604 | VEF
  1814. // 605 | VND
  1815. // 606 | VUV
  1816. // 607 | WST
  1817. // 608 | XAF
  1818. // 609 | XAG
  1819. // 610 | XAU
  1820. // 611 | XB5
  1821. // 612 | XBA
  1822. // 613 | XBB
  1823. // 614 | XBC
  1824. // 615 | XBD
  1825. // 616 | XCD
  1826. // 617 | XDR
  1827. // 618 | XFO
  1828. // 619 | XFU
  1829. // 620 | XOF
  1830. // 621 | XPD
  1831. // 622 | XPF
  1832. // 623 | XPT
  1833. // 624 | XTS
  1834. // 625 | XXX
  1835. // 626 | YER
  1836. // 627 | YUM
  1837. // 628 | ZAR
  1838. // 629 | ZMK
  1839. // 630 | ZMW
  1840. // 631 | ZWD
  1841. // 632 | ZWL
  1842. // 633 | ZWN
  1843. // 634 | ZWR
  1844. //
  1845. // Excelize support set custom number format for cell. For example, set number
  1846. // as date type in Uruguay (Spanish) format for Sheet1!A6:
  1847. //
  1848. // xlsx := excelize.NewFile()
  1849. // xlsx.SetCellValue("Sheet1", "A6", 42920.5)
  1850. // style, _ := xlsx.NewStyle(`{"custom_number_format": "[$-380A]dddd\\,\\ dd\" de \"mmmm\" de \"yyyy;@"}`)
  1851. // xlsx.SetCellStyle("Sheet1", "A6", "A6", style)
  1852. //
  1853. // Cell Sheet1!A6 in the Excel Application: martes, 04 de Julio de 2017
  1854. //
  1855. func (f *File) NewStyle(style string) (int, error) {
  1856. var cellXfsID, fontID, borderID, fillID int
  1857. s := f.stylesReader()
  1858. fs, err := parseFormatStyleSet(style)
  1859. if err != nil {
  1860. return cellXfsID, err
  1861. }
  1862. numFmtID := setNumFmt(s, fs)
  1863. if fs.Font != nil {
  1864. font, _ := xml.Marshal(setFont(fs))
  1865. s.Fonts.Count++
  1866. s.Fonts.Font = append(s.Fonts.Font, &xlsxFont{
  1867. Font: string(font[6 : len(font)-7]),
  1868. })
  1869. fontID = s.Fonts.Count - 1
  1870. }
  1871. s.Borders.Count++
  1872. s.Borders.Border = append(s.Borders.Border, setBorders(fs))
  1873. borderID = s.Borders.Count - 1
  1874. s.Fills.Count++
  1875. s.Fills.Fill = append(s.Fills.Fill, setFills(fs, true))
  1876. fillID = s.Fills.Count - 1
  1877. applyAlignment, alignment := fs.Alignment != nil, setAlignment(fs)
  1878. applyProtection, protection := fs.Protection != nil, setProtection(fs)
  1879. cellXfsID = setCellXfs(s, fontID, numFmtID, fillID, borderID, applyAlignment, applyProtection, alignment, protection)
  1880. return cellXfsID, nil
  1881. }
  1882. // NewConditionalStyle provides function to create style for conditional format
  1883. // by given style format. The parameters are the same as function NewStyle().
  1884. // Note that the color field uses RGB color code and only support to set font,
  1885. // fills, alignment and borders currently.
  1886. func (f *File) NewConditionalStyle(style string) (int, error) {
  1887. s := f.stylesReader()
  1888. fs, err := parseFormatStyleSet(style)
  1889. if err != nil {
  1890. return 0, err
  1891. }
  1892. dxf := dxf{
  1893. Fill: setFills(fs, false),
  1894. Alignment: setAlignment(fs),
  1895. Border: setBorders(fs),
  1896. }
  1897. if fs.Font != nil {
  1898. dxf.Font = setFont(fs)
  1899. }
  1900. dxfStr, _ := xml.Marshal(dxf)
  1901. if s.Dxfs == nil {
  1902. s.Dxfs = &xlsxDxfs{}
  1903. }
  1904. s.Dxfs.Count++
  1905. s.Dxfs.Dxfs = append(s.Dxfs.Dxfs, &xlsxDxf{
  1906. Dxf: string(dxfStr[5 : len(dxfStr)-6]),
  1907. })
  1908. return s.Dxfs.Count - 1, nil
  1909. }
  1910. // setFont provides function to add font style by given cell format settings.
  1911. func setFont(formatStyle *formatStyle) *font {
  1912. fontUnderlineType := map[string]string{"single": "single", "double": "double"}
  1913. if formatStyle.Font.Family == "" {
  1914. formatStyle.Font.Family = "Calibri"
  1915. }
  1916. if formatStyle.Font.Size < 1 {
  1917. formatStyle.Font.Size = 11
  1918. }
  1919. if formatStyle.Font.Color == "" {
  1920. formatStyle.Font.Color = "#000000"
  1921. }
  1922. f := font{
  1923. B: formatStyle.Font.Bold,
  1924. I: formatStyle.Font.Italic,
  1925. Sz: &attrValInt{Val: formatStyle.Font.Size},
  1926. Color: &xlsxColor{RGB: getPaletteColor(formatStyle.Font.Color)},
  1927. Name: &attrValString{Val: formatStyle.Font.Family},
  1928. Family: &attrValInt{Val: 2},
  1929. Scheme: &attrValString{Val: "minor"},
  1930. }
  1931. val, ok := fontUnderlineType[formatStyle.Font.Underline]
  1932. if ok {
  1933. f.U = &attrValString{Val: val}
  1934. }
  1935. return &f
  1936. }
  1937. // setNumFmt provides function to check if number format code in the range of
  1938. // built-in values.
  1939. func setNumFmt(style *xlsxStyleSheet, formatStyle *formatStyle) int {
  1940. dp := "0."
  1941. numFmtID := 164 // Default custom number format code from 164.
  1942. if formatStyle.DecimalPlaces < 0 || formatStyle.DecimalPlaces > 30 {
  1943. formatStyle.DecimalPlaces = 2
  1944. }
  1945. for i := 0; i < formatStyle.DecimalPlaces; i++ {
  1946. dp += "0"
  1947. }
  1948. if formatStyle.CustomNumFmt != nil {
  1949. return setCustomNumFmt(style, formatStyle)
  1950. }
  1951. _, ok := builtInNumFmt[formatStyle.NumFmt]
  1952. if !ok {
  1953. fc, currency := currencyNumFmt[formatStyle.NumFmt]
  1954. if !currency {
  1955. return setLangNumFmt(style, formatStyle)
  1956. }
  1957. fc = strings.Replace(fc, "0.00", dp, -1)
  1958. if formatStyle.NegRed {
  1959. fc = fc + ";[Red]" + fc
  1960. }
  1961. if style.NumFmts != nil {
  1962. numFmtID = style.NumFmts.NumFmt[len(style.NumFmts.NumFmt)-1].NumFmtID + 1
  1963. nf := xlsxNumFmt{
  1964. FormatCode: fc,
  1965. NumFmtID: numFmtID,
  1966. }
  1967. style.NumFmts.NumFmt = append(style.NumFmts.NumFmt, &nf)
  1968. style.NumFmts.Count++
  1969. } else {
  1970. nf := xlsxNumFmt{
  1971. FormatCode: fc,
  1972. NumFmtID: numFmtID,
  1973. }
  1974. numFmts := xlsxNumFmts{
  1975. NumFmt: []*xlsxNumFmt{&nf},
  1976. Count: 1,
  1977. }
  1978. style.NumFmts = &numFmts
  1979. }
  1980. return numFmtID
  1981. }
  1982. return formatStyle.NumFmt
  1983. }
  1984. // setCustomNumFmt provides function to set custom number format code.
  1985. func setCustomNumFmt(style *xlsxStyleSheet, formatStyle *formatStyle) int {
  1986. nf := xlsxNumFmt{FormatCode: *formatStyle.CustomNumFmt}
  1987. if style.NumFmts != nil {
  1988. nf.NumFmtID = style.NumFmts.NumFmt[len(style.NumFmts.NumFmt)-1].NumFmtID + 1
  1989. style.NumFmts.NumFmt = append(style.NumFmts.NumFmt, &nf)
  1990. style.NumFmts.Count++
  1991. } else {
  1992. nf.NumFmtID = 164
  1993. numFmts := xlsxNumFmts{
  1994. NumFmt: []*xlsxNumFmt{&nf},
  1995. Count: 1,
  1996. }
  1997. style.NumFmts = &numFmts
  1998. }
  1999. return nf.NumFmtID
  2000. }
  2001. // setLangNumFmt provides function to set number format code with language.
  2002. func setLangNumFmt(style *xlsxStyleSheet, formatStyle *formatStyle) int {
  2003. numFmts, ok := langNumFmt[formatStyle.Lang]
  2004. if !ok {
  2005. return 0
  2006. }
  2007. var fc string
  2008. fc, ok = numFmts[formatStyle.NumFmt]
  2009. if !ok {
  2010. return 0
  2011. }
  2012. nf := xlsxNumFmt{FormatCode: fc}
  2013. if style.NumFmts != nil {
  2014. nf.NumFmtID = style.NumFmts.NumFmt[len(style.NumFmts.NumFmt)-1].NumFmtID + 1
  2015. style.NumFmts.NumFmt = append(style.NumFmts.NumFmt, &nf)
  2016. style.NumFmts.Count++
  2017. } else {
  2018. nf.NumFmtID = formatStyle.NumFmt
  2019. numFmts := xlsxNumFmts{
  2020. NumFmt: []*xlsxNumFmt{&nf},
  2021. Count: 1,
  2022. }
  2023. style.NumFmts = &numFmts
  2024. }
  2025. return nf.NumFmtID
  2026. }
  2027. // setFills provides function to add fill elements in the styles.xml by given
  2028. // cell format settings.
  2029. func setFills(formatStyle *formatStyle, fg bool) *xlsxFill {
  2030. var patterns = []string{
  2031. "none",
  2032. "solid",
  2033. "mediumGray",
  2034. "darkGray",
  2035. "lightGray",
  2036. "darkHorizontal",
  2037. "darkVertical",
  2038. "darkDown",
  2039. "darkUp",
  2040. "darkGrid",
  2041. "darkTrellis",
  2042. "lightHorizontal",
  2043. "lightVertical",
  2044. "lightDown",
  2045. "lightUp",
  2046. "lightGrid",
  2047. "lightTrellis",
  2048. "gray125",
  2049. "gray0625",
  2050. }
  2051. var variants = []float64{
  2052. 90,
  2053. 0,
  2054. 45,
  2055. 135,
  2056. }
  2057. var fill xlsxFill
  2058. switch formatStyle.Fill.Type {
  2059. case "gradient":
  2060. if len(formatStyle.Fill.Color) != 2 {
  2061. break
  2062. }
  2063. var gradient xlsxGradientFill
  2064. switch formatStyle.Fill.Shading {
  2065. case 0, 1, 2, 3:
  2066. gradient.Degree = variants[formatStyle.Fill.Shading]
  2067. case 4:
  2068. gradient.Type = "path"
  2069. case 5:
  2070. gradient.Type = "path"
  2071. gradient.Bottom = 0.5
  2072. gradient.Left = 0.5
  2073. gradient.Right = 0.5
  2074. gradient.Top = 0.5
  2075. default:
  2076. break
  2077. }
  2078. var stops []*xlsxGradientFillStop
  2079. for index, color := range formatStyle.Fill.Color {
  2080. var stop xlsxGradientFillStop
  2081. stop.Position = float64(index)
  2082. stop.Color.RGB = getPaletteColor(color)
  2083. stops = append(stops, &stop)
  2084. }
  2085. gradient.Stop = stops
  2086. fill.GradientFill = &gradient
  2087. case "pattern":
  2088. if formatStyle.Fill.Pattern > 18 || formatStyle.Fill.Pattern < 0 {
  2089. break
  2090. }
  2091. if len(formatStyle.Fill.Color) < 1 {
  2092. break
  2093. }
  2094. var pattern xlsxPatternFill
  2095. pattern.PatternType = patterns[formatStyle.Fill.Pattern]
  2096. if fg {
  2097. pattern.FgColor.RGB = getPaletteColor(formatStyle.Fill.Color[0])
  2098. } else {
  2099. pattern.BgColor.RGB = getPaletteColor(formatStyle.Fill.Color[0])
  2100. }
  2101. fill.PatternFill = &pattern
  2102. }
  2103. return &fill
  2104. }
  2105. // setAlignment provides function to formatting information pertaining to text
  2106. // alignment in cells. There are a variety of choices for how text is aligned
  2107. // both horizontally and vertically, as well as indentation settings, and so on.
  2108. func setAlignment(formatStyle *formatStyle) *xlsxAlignment {
  2109. var alignment xlsxAlignment
  2110. if formatStyle.Alignment != nil {
  2111. alignment.Horizontal = formatStyle.Alignment.Horizontal
  2112. alignment.Indent = formatStyle.Alignment.Indent
  2113. alignment.JustifyLastLine = formatStyle.Alignment.JustifyLastLine
  2114. alignment.ReadingOrder = formatStyle.Alignment.ReadingOrder
  2115. alignment.RelativeIndent = formatStyle.Alignment.RelativeIndent
  2116. alignment.ShrinkToFit = formatStyle.Alignment.ShrinkToFit
  2117. alignment.TextRotation = formatStyle.Alignment.TextRotation
  2118. alignment.Vertical = formatStyle.Alignment.Vertical
  2119. alignment.WrapText = formatStyle.Alignment.WrapText
  2120. }
  2121. return &alignment
  2122. }
  2123. // setProtection provides function to set protection properties associated
  2124. // with the cell.
  2125. func setProtection(formatStyle *formatStyle) *xlsxProtection {
  2126. var protection xlsxProtection
  2127. if formatStyle.Protection != nil {
  2128. protection.Hidden = formatStyle.Protection.Hidden
  2129. protection.Locked = formatStyle.Protection.Locked
  2130. }
  2131. return &protection
  2132. }
  2133. // setBorders provides function to add border elements in the styles.xml by
  2134. // given borders format settings.
  2135. func setBorders(formatStyle *formatStyle) *xlsxBorder {
  2136. var styles = []string{
  2137. "none",
  2138. "thin",
  2139. "medium",
  2140. "dashed",
  2141. "dotted",
  2142. "thick",
  2143. "double",
  2144. "hair",
  2145. "mediumDashed",
  2146. "dashDot",
  2147. "mediumDashDot",
  2148. "dashDotDot",
  2149. "mediumDashDotDot",
  2150. "slantDashDot",
  2151. }
  2152. var border xlsxBorder
  2153. for _, v := range formatStyle.Border {
  2154. if 0 <= v.Style && v.Style < 14 {
  2155. var color xlsxColor
  2156. color.RGB = getPaletteColor(v.Color)
  2157. switch v.Type {
  2158. case "left":
  2159. border.Left.Style = styles[v.Style]
  2160. border.Left.Color = &color
  2161. case "right":
  2162. border.Right.Style = styles[v.Style]
  2163. border.Right.Color = &color
  2164. case "top":
  2165. border.Top.Style = styles[v.Style]
  2166. border.Top.Color = &color
  2167. case "bottom":
  2168. border.Bottom.Style = styles[v.Style]
  2169. border.Bottom.Color = &color
  2170. case "diagonalUp":
  2171. border.Diagonal.Style = styles[v.Style]
  2172. border.Diagonal.Color = &color
  2173. border.DiagonalUp = true
  2174. case "diagonalDown":
  2175. border.Diagonal.Style = styles[v.Style]
  2176. border.Diagonal.Color = &color
  2177. border.DiagonalDown = true
  2178. }
  2179. }
  2180. }
  2181. return &border
  2182. }
  2183. // setCellXfs provides function to set describes all of the formatting for a
  2184. // cell.
  2185. func setCellXfs(style *xlsxStyleSheet, fontID, numFmtID, fillID, borderID int, applyAlignment, applyProtection bool, alignment *xlsxAlignment, protection *xlsxProtection) int {
  2186. var xf xlsxXf
  2187. xf.FontID = fontID
  2188. if fontID != 0 {
  2189. xf.ApplyFont = true
  2190. }
  2191. xf.NumFmtID = numFmtID
  2192. if numFmtID != 0 {
  2193. xf.ApplyNumberFormat = true
  2194. }
  2195. xf.FillID = fillID
  2196. xf.BorderID = borderID
  2197. style.CellXfs.Count++
  2198. xf.Alignment = alignment
  2199. xf.ApplyAlignment = applyAlignment
  2200. if applyProtection {
  2201. xf.ApplyProtection = applyProtection
  2202. xf.Protection = protection
  2203. }
  2204. xfID := 0
  2205. xf.XfID = &xfID
  2206. style.CellXfs.Xf = append(style.CellXfs.Xf, xf)
  2207. return style.CellXfs.Count - 1
  2208. }
  2209. // SetCellStyle provides function to add style attribute for cells by given
  2210. // worksheet name, coordinate area and style ID. Note that diagonalDown and
  2211. // diagonalUp type border should be use same color in the same coordinate area.
  2212. //
  2213. // For example create a borders of cell H9 on Sheet1:
  2214. //
  2215. // style, err := xlsx.NewStyle(`{"border":[{"type":"left","color":"0000FF","style":3},{"type":"top","color":"00FF00","style":4},{"type":"bottom","color":"FFFF00","style":5},{"type":"right","color":"FF0000","style":6},{"type":"diagonalDown","color":"A020F0","style":7},{"type":"diagonalUp","color":"A020F0","style":8}]}`)
  2216. // if err != nil {
  2217. // fmt.Println(err)
  2218. // }
  2219. // xlsx.SetCellStyle("Sheet1", "H9", "H9", style)
  2220. //
  2221. // Set gradient fill with vertical variants shading styles for cell H9 on
  2222. // Sheet1:
  2223. //
  2224. // style, err := xlsx.NewStyle(`{"fill":{"type":"gradient","color":["#FFFFFF","#E0EBF5"],"shading":1}}`)
  2225. // if err != nil {
  2226. // fmt.Println(err)
  2227. // }
  2228. // xlsx.SetCellStyle("Sheet1", "H9", "H9", style)
  2229. //
  2230. // Set solid style pattern fill for cell H9 on Sheet1:
  2231. //
  2232. // style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["#E0EBF5"],"pattern":1}}`)
  2233. // if err != nil {
  2234. // fmt.Println(err)
  2235. // }
  2236. // xlsx.SetCellStyle("Sheet1", "H9", "H9", style)
  2237. //
  2238. // Set alignment style for cell H9 on Sheet1:
  2239. //
  2240. // style, err := xlsx.NewStyle(`{"alignment":{"horizontal":"center","ident":1,"justify_last_line":true,"reading_order":0,"relative_indent":1,"shrink_to_fit":true,"text_rotation":45,"vertical":"","wrap_text":true}}`)
  2241. // if err != nil {
  2242. // fmt.Println(err)
  2243. // }
  2244. // xlsx.SetCellStyle("Sheet1", "H9", "H9", style)
  2245. //
  2246. // Dates and times in Excel are represented by real numbers, for example "Apr 7
  2247. // 2017 12:00 PM" is represented by the number 42920.5. Set date and time format
  2248. // for cell H9 on Sheet1:
  2249. //
  2250. // xlsx.SetCellValue("Sheet1", "H9", 42920.5)
  2251. // style, err := xlsx.NewStyle(`{"number_format": 22}`)
  2252. // if err != nil {
  2253. // fmt.Println(err)
  2254. // }
  2255. // xlsx.SetCellStyle("Sheet1", "H9", "H9", style)
  2256. //
  2257. // Set font style for cell H9 on Sheet1:
  2258. //
  2259. // style, err := xlsx.NewStyle(`{"font":{"bold":true,"italic":true,"family":"Berlin Sans FB Demi","size":36,"color":"#777777"}}`)
  2260. // if err != nil {
  2261. // fmt.Println(err)
  2262. // }
  2263. // xlsx.SetCellStyle("Sheet1", "H9", "H9", style)
  2264. //
  2265. // Hide and lock for cell H9 on Sheet1:
  2266. //
  2267. // style, err := xlsx.NewStyle(`{"protection":{"hidden":true, "locked":true}}`)
  2268. // if err != nil {
  2269. // fmt.Println(err)
  2270. // }
  2271. // xlsx.SetCellStyle("Sheet1", "H9", "H9", style)
  2272. //
  2273. func (f *File) SetCellStyle(sheet, hcell, vcell string, styleID int) {
  2274. hcell = strings.ToUpper(hcell)
  2275. vcell = strings.ToUpper(vcell)
  2276. // Coordinate conversion, convert C1:B3 to 2,0,1,2.
  2277. hcol := string(strings.Map(letterOnlyMapF, hcell))
  2278. hrow, err := strconv.Atoi(strings.Map(intOnlyMapF, hcell))
  2279. if err != nil {
  2280. return
  2281. }
  2282. hyAxis := hrow - 1
  2283. hxAxis := TitleToNumber(hcol)
  2284. vcol := string(strings.Map(letterOnlyMapF, vcell))
  2285. vrow, err := strconv.Atoi(strings.Map(intOnlyMapF, vcell))
  2286. if err != nil {
  2287. return
  2288. }
  2289. vyAxis := vrow - 1
  2290. vxAxis := TitleToNumber(vcol)
  2291. // Correct the coordinate area, such correct C1:B3 to B1:C3.
  2292. if vxAxis < hxAxis {
  2293. vxAxis, hxAxis = hxAxis, vxAxis
  2294. }
  2295. if vyAxis < hyAxis {
  2296. vyAxis, hyAxis = hyAxis, vyAxis
  2297. }
  2298. xlsx := f.workSheetReader(sheet)
  2299. completeRow(xlsx, vyAxis+1, vxAxis+1)
  2300. completeCol(xlsx, vyAxis+1, vxAxis+1)
  2301. for r := hyAxis; r <= vyAxis; r++ {
  2302. for k := hxAxis; k <= vxAxis; k++ {
  2303. xlsx.SheetData.Row[r].C[k].S = styleID
  2304. }
  2305. }
  2306. }
  2307. // SetConditionalFormat provides function to create conditional formatting rule
  2308. // for cell value. Conditional formatting is a feature of Excel which allows you
  2309. // to apply a format to a cell or a range of cells based on certain criteria.
  2310. //
  2311. // The type option is a required parameter and it has no default value.
  2312. // Allowable type values and their associated parameters are:
  2313. //
  2314. // Type | Parameters
  2315. // ---------------+------------------------------------
  2316. // cell | criteria
  2317. // | value
  2318. // | minimum
  2319. // | maximum
  2320. // date | criteria
  2321. // | value
  2322. // | minimum
  2323. // | maximum
  2324. // time_period | criteria
  2325. // text | criteria
  2326. // | value
  2327. // average | criteria
  2328. // duplicate | (none)
  2329. // unique | (none)
  2330. // top | criteria
  2331. // | value
  2332. // bottom | criteria
  2333. // | value
  2334. // blanks | (none)
  2335. // no_blanks | (none)
  2336. // errors | (none)
  2337. // no_errors | (none)
  2338. // 2_color_scale | min_type
  2339. // | max_type
  2340. // | min_value
  2341. // | max_value
  2342. // | min_color
  2343. // | max_color
  2344. // 3_color_scale | min_type
  2345. // | mid_type
  2346. // | max_type
  2347. // | min_value
  2348. // | mid_value
  2349. // | max_value
  2350. // | min_color
  2351. // | mid_color
  2352. // | max_color
  2353. // data_bar | min_type
  2354. // | max_type
  2355. // | min_value
  2356. // | max_value
  2357. // | bar_color
  2358. // formula | criteria
  2359. //
  2360. // The criteria parameter is used to set the criteria by which the cell data
  2361. // will be evaluated. It has no default value. The most common criteria as
  2362. // applied to {'type': 'cell'} are:
  2363. //
  2364. // between |
  2365. // not between |
  2366. // equal to | ==
  2367. // not equal to | !=
  2368. // greater than | >
  2369. // less than | <
  2370. // greater than or equal to | >=
  2371. // less than or equal to | <=
  2372. //
  2373. // You can either use Excel's textual description strings, in the first column
  2374. // above, or the more common symbolic alternatives.
  2375. //
  2376. // Additional criteria which are specific to other conditional format types are
  2377. // shown in the relevant sections below.
  2378. //
  2379. // value: The value is generally used along with the criteria parameter to set
  2380. // the rule by which the cell data will be evaluated:
  2381. //
  2382. // xlsx.SetConditionalFormat("Sheet1", "D1:D10", fmt.Sprintf(`[{"type":"cell","criteria":">","format":%d,"value":"6"}]`, format))
  2383. //
  2384. // The value property can also be an cell reference:
  2385. //
  2386. // xlsx.SetConditionalFormat("Sheet1", "D1:D10", fmt.Sprintf(`[{"type":"cell","criteria":">","format":%d,"value":"$C$1"}]`, format))
  2387. //
  2388. // type: format - The format parameter is used to specify the format that will
  2389. // be applied to the cell when the conditional formatting criterion is met. The
  2390. // format is created using the NewConditionalStyle() method in the same way as
  2391. // cell formats:
  2392. //
  2393. // format, err = xlsx.NewConditionalStyle(`{"font":{"color":"#9A0511"},"fill":{"type":"pattern","color":["#FEC7CE"],"pattern":1}}`)
  2394. // if err != nil {
  2395. // fmt.Println(err)
  2396. // }
  2397. // xlsx.SetConditionalFormat("Sheet1", "A1:A10", fmt.Sprintf(`[{"type":"cell","criteria":">","format":%d,"value":"6"}]`, format))
  2398. //
  2399. // Note: In Excel, a conditional format is superimposed over the existing cell
  2400. // format and not all cell format properties can be modified. Properties that
  2401. // cannot be modified in a conditional format are font name, font size,
  2402. // superscript and subscript, diagonal borders, all alignment properties and all
  2403. // protection properties.
  2404. //
  2405. // Excel specifies some default formats to be used with conditional formatting.
  2406. // These can be replicated using the following excelize formats:
  2407. //
  2408. // // Rose format for bad conditional.
  2409. // format1, err = xlsx.NewConditionalStyle(`{"font":{"color":"#9A0511"},"fill":{"type":"pattern","color":["#FEC7CE"],"pattern":1}}`)
  2410. //
  2411. // // Light yellow format for neutral conditional.
  2412. // format2, err = xlsx.NewConditionalStyle(`{"font":{"color":"#9B5713"},"fill":{"type":"pattern","color":["#FEEAA0"],"pattern":1}}`)
  2413. //
  2414. // // Light green format for good conditional.
  2415. // format3, err = xlsx.NewConditionalStyle(`{"font":{"color":"#09600B"},"fill":{"type":"pattern","color":["#C7EECF"],"pattern":1}}`)
  2416. //
  2417. // type: minimum - The minimum parameter is used to set the lower limiting value
  2418. // when the criteria is either "between" or "not between".
  2419. //
  2420. // // Hightlight cells rules: between...
  2421. // xlsx.SetConditionalFormat("Sheet1", "A1:A10", fmt.Sprintf(`[{"type":"cell","criteria":"between","format":%d,"minimum":"6","maximum":"8"}]`, format))
  2422. //
  2423. // type: maximum - The maximum parameter is used to set the upper limiting value
  2424. // when the criteria is either "between" or "not between". See the previous
  2425. // example.
  2426. //
  2427. // type: average - The average type is used to specify Excel's "Average" style
  2428. // conditional format:
  2429. //
  2430. // // Top/Bottom rules: Above Average...
  2431. // xlsx.SetConditionalFormat("Sheet1", "A1:A10", fmt.Sprintf(`[{"type":"average","criteria":"=","format":%d, "above_average": true}]`, format1))
  2432. //
  2433. // // Top/Bottom rules: Below Average...
  2434. // xlsx.SetConditionalFormat("Sheet1", "B1:B10", fmt.Sprintf(`[{"type":"average","criteria":"=","format":%d, "above_average": false}]`, format2))
  2435. //
  2436. // type: duplicate - The duplicate type is used to highlight duplicate cells in a range:
  2437. //
  2438. // // Hightlight cells rules: Duplicate Values...
  2439. // xlsx.SetConditionalFormat("Sheet1", "A1:A10", fmt.Sprintf(`[{"type":"duplicate","criteria":"=","format":%d}]`, format))
  2440. //
  2441. // type: unique - The unique type is used to highlight unique cells in a range:
  2442. //
  2443. // // Hightlight cells rules: Not Equal To...
  2444. // xlsx.SetConditionalFormat("Sheet1", "A1:A10", fmt.Sprintf(`[{"type":"unique","criteria":"=","format":%d}]`, format))
  2445. //
  2446. // type: top - The top type is used to specify the top n values by number or percentage in a range:
  2447. //
  2448. // // Top/Bottom rules: Top 10.
  2449. // xlsx.SetConditionalFormat("Sheet1", "H1:H10", fmt.Sprintf(`[{"type":"top","criteria":"=","format":%d,"value":"6"}]`, format))
  2450. //
  2451. // The criteria can be used to indicate that a percentage condition is required:
  2452. //
  2453. // xlsx.SetConditionalFormat("Sheet1", "A1:A10", fmt.Sprintf(`[{"type":"top","criteria":"=","format":%d,"value":"6","percent":true}]`, format))
  2454. //
  2455. // type: 2_color_scale - The 2_color_scale type is used to specify Excel's "2
  2456. // Color Scale" style conditional format:
  2457. //
  2458. // // Color scales: 2 color.
  2459. // xlsx.SetConditionalFormat("Sheet1", "A1:A10", `[{"type":"2_color_scale","criteria":"=","min_type":"min","max_type":"max","min_color":"#F8696B","max_color":"#63BE7B"}]`)
  2460. //
  2461. // This conditional type can be modified with min_type, max_type, min_value,
  2462. // max_value, min_color and max_color, see below.
  2463. //
  2464. // type: 3_color_scale - The 3_color_scale type is used to specify Excel's "3
  2465. // Color Scale" style conditional format:
  2466. //
  2467. // // Color scales: 3 color.
  2468. // xlsx.SetConditionalFormat("Sheet1", "A1:A10", `[{"type":"3_color_scale","criteria":"=","min_type":"min","mid_type":"percentile","max_type":"max","min_color":"#F8696B","mid_color":"#FFEB84","max_color":"#63BE7B"}]`)
  2469. //
  2470. // This conditional type can be modified with min_type, mid_type, max_type,
  2471. // min_value, mid_value, max_value, min_color, mid_color and max_color, see
  2472. // below.
  2473. //
  2474. // type: data_bar - The data_bar type is used to specify Excel's "Data Bar"
  2475. // style conditional format.
  2476. //
  2477. // min_type - The min_type and max_type properties are available when the conditional formatting type is 2_color_scale, 3_color_scale or data_bar. The mid_type is available for 3_color_scale. The properties are used as follows:
  2478. //
  2479. // // Data Bars: Gradient Fill.
  2480. // xlsx.SetConditionalFormat("Sheet1", "K1:K10", `[{"type":"data_bar", "criteria":"=", "min_type":"min","max_type":"max","bar_color":"#638EC6"}]`)
  2481. //
  2482. // The available min/mid/max types are:
  2483. //
  2484. // min (for min_type only)
  2485. // num
  2486. // percent
  2487. // percentile
  2488. // formula
  2489. // max (for max_type only)
  2490. //
  2491. // mid_type - Used for 3_color_scale. Same as min_type, see above.
  2492. //
  2493. // max_type - Same as min_type, see above.
  2494. //
  2495. // min_value - The min_value and max_value properties are available when the
  2496. // conditional formatting type is 2_color_scale, 3_color_scale or data_bar. The
  2497. // mid_value is available for 3_color_scale.
  2498. //
  2499. // mid_value - Used for 3_color_scale. Same as min_value, see above.
  2500. //
  2501. // max_value - Same as min_value, see above.
  2502. //
  2503. // min_color - The min_color and max_color properties are available when the
  2504. // conditional formatting type is 2_color_scale, 3_color_scale or data_bar.
  2505. // The mid_color is available for 3_color_scale. The properties are used as
  2506. // follows:
  2507. //
  2508. // // Color scales: 3 color.
  2509. // xlsx.SetConditionalFormat("Sheet1", "B1:B10", `[{"type":"3_color_scale","criteria":"=","min_type":"min","mid_type":"percentile","max_type":"max","min_color":"#F8696B","mid_color":"#FFEB84","max_color":"#63BE7B"}]`)
  2510. //
  2511. // mid_color - Used for 3_color_scale. Same as min_color, see above.
  2512. //
  2513. // max_color - Same as min_color, see above.
  2514. //
  2515. // bar_color - Used for data_bar. Same as min_color, see above.
  2516. //
  2517. func (f *File) SetConditionalFormat(sheet, area, formatSet string) {
  2518. var format []*formatConditional
  2519. json.Unmarshal([]byte(formatSet), &format)
  2520. drawContFmtFunc := map[string]func(p int, ct string, fmtCond *formatConditional) *xlsxCfRule{
  2521. "cellIs": drawCondFmtCellIs,
  2522. "top10": drawCondFmtTop10,
  2523. "aboveAverage": drawCondFmtAboveAverage,
  2524. "duplicateValues": drawCondFmtDuplicateUniqueValues,
  2525. "uniqueValues": drawCondFmtDuplicateUniqueValues,
  2526. "2_color_scale": drawCondFmtColorScale,
  2527. "3_color_scale": drawCondFmtColorScale,
  2528. "dataBar": drawCondFmtDataBar,
  2529. "expression": drawConfFmtExp,
  2530. }
  2531. xlsx := f.workSheetReader(sheet)
  2532. cfRule := []*xlsxCfRule{}
  2533. for p, v := range format {
  2534. var vt, ct string
  2535. var ok bool
  2536. // "type" is a required parameter, check for valid validation types.
  2537. vt, ok = validType[v.Type]
  2538. if ok {
  2539. // Check for valid criteria types.
  2540. ct, ok = criteriaType[v.Criteria]
  2541. if ok || vt == "expression" {
  2542. drawfunc, ok := drawContFmtFunc[vt]
  2543. if ok {
  2544. cfRule = append(cfRule, drawfunc(p, ct, v))
  2545. }
  2546. }
  2547. }
  2548. }
  2549. xlsx.ConditionalFormatting = append(xlsx.ConditionalFormatting, &xlsxConditionalFormatting{
  2550. SQRef: area,
  2551. CfRule: cfRule,
  2552. })
  2553. }
  2554. // drawCondFmtCellIs provides function to create conditional formatting rule for
  2555. // cell value (include between, not between, equal, not equal, greater than and
  2556. // less than) by given priority, criteria type and format settings.
  2557. func drawCondFmtCellIs(p int, ct string, format *formatConditional) *xlsxCfRule {
  2558. c := &xlsxCfRule{
  2559. Priority: p + 1,
  2560. Type: validType[format.Type],
  2561. Operator: ct,
  2562. DxfID: &format.Format,
  2563. }
  2564. // "between" and "not between" criteria require 2 values.
  2565. _, ok := map[string]bool{"between": true, "notBetween": true}[ct]
  2566. if ok {
  2567. c.Formula = append(c.Formula, format.Minimum)
  2568. c.Formula = append(c.Formula, format.Maximum)
  2569. }
  2570. _, ok = map[string]bool{"equal": true, "notEqual": true, "greaterThan": true, "lessThan": true}[ct]
  2571. if ok {
  2572. c.Formula = append(c.Formula, format.Value)
  2573. }
  2574. return c
  2575. }
  2576. // drawCondFmtTop10 provides function to create conditional formatting rule for
  2577. // top N (default is top 10) by given priority, criteria type and format
  2578. // settings.
  2579. func drawCondFmtTop10(p int, ct string, format *formatConditional) *xlsxCfRule {
  2580. c := &xlsxCfRule{
  2581. Priority: p + 1,
  2582. Type: validType[format.Type],
  2583. Rank: 10,
  2584. DxfID: &format.Format,
  2585. Percent: format.Percent,
  2586. }
  2587. rank, err := strconv.Atoi(format.Value)
  2588. if err == nil {
  2589. c.Rank = rank
  2590. }
  2591. return c
  2592. }
  2593. // drawCondFmtAboveAverage provides function to create conditional formatting
  2594. // rule for above average and below average by given priority, criteria type and
  2595. // format settings.
  2596. func drawCondFmtAboveAverage(p int, ct string, format *formatConditional) *xlsxCfRule {
  2597. return &xlsxCfRule{
  2598. Priority: p + 1,
  2599. Type: validType[format.Type],
  2600. AboveAverage: &format.AboveAverage,
  2601. DxfID: &format.Format,
  2602. }
  2603. }
  2604. // drawCondFmtDuplicateUniqueValues provides function to create conditional
  2605. // formatting rule for duplicate and unique values by given priority, criteria
  2606. // type and format settings.
  2607. func drawCondFmtDuplicateUniqueValues(p int, ct string, format *formatConditional) *xlsxCfRule {
  2608. return &xlsxCfRule{
  2609. Priority: p + 1,
  2610. Type: validType[format.Type],
  2611. DxfID: &format.Format,
  2612. }
  2613. }
  2614. // drawCondFmtColorScale provides function to create conditional formatting rule
  2615. // for color scale (include 2 color scale and 3 color scale) by given priority,
  2616. // criteria type and format settings.
  2617. func drawCondFmtColorScale(p int, ct string, format *formatConditional) *xlsxCfRule {
  2618. c := &xlsxCfRule{
  2619. Priority: p + 1,
  2620. Type: "colorScale",
  2621. ColorScale: &xlsxColorScale{
  2622. Cfvo: []*xlsxCfvo{
  2623. {Type: format.MinType},
  2624. },
  2625. Color: []*xlsxColor{
  2626. {RGB: getPaletteColor(format.MinColor)},
  2627. },
  2628. },
  2629. }
  2630. if validType[format.Type] == "3_color_scale" {
  2631. c.ColorScale.Cfvo = append(c.ColorScale.Cfvo, &xlsxCfvo{Type: format.MidType, Val: 50})
  2632. c.ColorScale.Color = append(c.ColorScale.Color, &xlsxColor{RGB: getPaletteColor(format.MidColor)})
  2633. }
  2634. c.ColorScale.Cfvo = append(c.ColorScale.Cfvo, &xlsxCfvo{Type: format.MaxType})
  2635. c.ColorScale.Color = append(c.ColorScale.Color, &xlsxColor{RGB: getPaletteColor(format.MaxColor)})
  2636. return c
  2637. }
  2638. // drawCondFmtDataBar provides function to create conditional formatting rule
  2639. // for data bar by given priority, criteria type and format settings.
  2640. func drawCondFmtDataBar(p int, ct string, format *formatConditional) *xlsxCfRule {
  2641. return &xlsxCfRule{
  2642. Priority: p + 1,
  2643. Type: validType[format.Type],
  2644. DataBar: &xlsxDataBar{
  2645. Cfvo: []*xlsxCfvo{{Type: format.MinType}, {Type: format.MaxType}},
  2646. Color: []*xlsxColor{{RGB: getPaletteColor(format.BarColor)}},
  2647. },
  2648. }
  2649. }
  2650. // drawConfFmtExp provides function to create conditional formatting rule for
  2651. // expression by given priority, criteria type and format settings.
  2652. func drawConfFmtExp(p int, ct string, format *formatConditional) *xlsxCfRule {
  2653. return &xlsxCfRule{
  2654. Priority: p + 1,
  2655. Type: validType[format.Type],
  2656. Formula: []string{format.Criteria},
  2657. DxfID: &format.Format,
  2658. }
  2659. }
  2660. // getPaletteColor provides function to convert the RBG color by given string.
  2661. func getPaletteColor(color string) string {
  2662. return "FF" + strings.Replace(strings.ToUpper(color), "#", "", -1)
  2663. }