styles.go 87 KB

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