1 19 20 package jxl.write; 21 22 import jxl.format.Format; 23 import jxl.biff.DisplayFormat; 24 25 28 public final class NumberFormats 29 { 30 33 private static class BuiltInFormat implements DisplayFormat, Format 34 { 35 38 private int index; 39 40 43 private String formatString; 44 45 51 public BuiltInFormat(int i, String s) 52 { 53 index = i; 54 formatString = s; 55 } 56 57 62 public int getFormatIndex() 63 { 64 return index; 65 } 66 72 public boolean isInitialized() 73 { 74 return true; 75 } 76 81 public boolean isBuiltIn() 82 { 83 return true; 84 } 85 92 public void initialize(int pos) 93 { 94 } 95 102 public String getFormatString() 103 { 104 return formatString; 105 } 106 107 113 public boolean equals(Object o) 114 { 115 if (o == this) 116 { 117 return true; 118 } 119 120 if (!(o instanceof BuiltInFormat)) 121 { 122 return false; 123 } 124 125 BuiltInFormat bif = (BuiltInFormat) o; 126 127 return index == bif.index; 128 } 129 130 135 public int hashCode() 136 { 137 return index; 138 } 139 } 140 141 142 145 148 public static final DisplayFormat DEFAULT = new BuiltInFormat(0x0, "#"); 149 153 public static final DisplayFormat INTEGER = new BuiltInFormat(0x1, "0"); 154 155 159 public static final DisplayFormat FLOAT = new BuiltInFormat(0x2, "0.00"); 160 161 165 public static final DisplayFormat THOUSANDS_INTEGER = 166 new BuiltInFormat(0x3, "#,##0"); 167 168 172 public static final DisplayFormat THOUSANDS_FLOAT = 173 new BuiltInFormat(0x4, "#,##0.00"); 174 175 180 public static final DisplayFormat ACCOUNTING_INTEGER = 181 new BuiltInFormat(0x5, "$#,##0;($#,##0)"); 182 183 186 public static final DisplayFormat ACCOUNTING_RED_INTEGER = 187 new BuiltInFormat(0x6, "$#,##0;($#,##0)"); 188 189 194 public static final DisplayFormat ACCOUNTING_FLOAT = 195 new BuiltInFormat(0x7, "$#,##0;($#,##0)"); 196 197 200 public static final DisplayFormat ACCOUNTING_RED_FLOAT = 201 new BuiltInFormat(0x8, "$#,##0;($#,##0)"); 202 203 207 public static final DisplayFormat PERCENT_INTEGER = 208 new BuiltInFormat(0x9, "0%"); 209 210 214 public static final DisplayFormat PERCENT_FLOAT = 215 new BuiltInFormat(0xa, "0.00%"); 216 217 221 public static final DisplayFormat EXPONENTIAL = 222 new BuiltInFormat(0xb, "0.00E00"); 223 224 226 229 public static final DisplayFormat FORMAT1 = 230 new BuiltInFormat(0x25, "#,##0;(#,##0)"); 231 232 235 public static final DisplayFormat FORMAT2 = 236 new BuiltInFormat(0x26, "#,##0;(#,##0)"); 237 238 241 public static final DisplayFormat FORMAT3 = 242 new BuiltInFormat(0x27, "#,##0.00;(#,##0.00)"); 243 244 247 public static final DisplayFormat FORMAT4 = 248 new BuiltInFormat(0x28, "#,##0.00;(#,##0.00)"); 249 250 253 public static final DisplayFormat FORMAT5 = 254 new BuiltInFormat(0x29, "#,##0;(#,##0)"); 255 256 259 public static final DisplayFormat FORMAT6 = 260 new BuiltInFormat(0x2a, "#,##0;(#,##0)"); 261 262 265 public static final DisplayFormat FORMAT7 = 266 new BuiltInFormat(0x2b, "#,##0.00;(#,##0.00)"); 267 268 271 public static final DisplayFormat FORMAT8 = 272 new BuiltInFormat(0x2c, "#,##0.00;(#,##0.00)"); 273 274 277 public static final DisplayFormat FORMAT9 = 278 new BuiltInFormat(0x2e, "#,##0.00;(#,##0.00)"); 279 280 283 public static final DisplayFormat FORMAT10 = 284 new BuiltInFormat(0x30, "##0.0E0"); 285 286 289 public static final DisplayFormat TEXT = new BuiltInFormat(0x31, "@"); 290 } 291 292 293 | Popular Tags |