styles.go 84 KB

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