styles.go 85 KB

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