1 16 17 18 23 package org.apache.poi.hssf.usermodel; 24 25 import org.apache.poi.hssf.record.FontRecord; 26 27 36 37 public class HSSFFont 38 { 39 40 43 44 public final static String FONT_ARIAL = "Arial"; 45 46 49 50 public final static short BOLDWEIGHT_NORMAL = 0x190; 51 52 55 56 public final static short BOLDWEIGHT_BOLD = 0x2bc; 57 58 61 62 public final static short COLOR_NORMAL = 0x7fff; 63 64 67 68 public final static short COLOR_RED = 0xa; 69 70 73 74 public final static short SS_NONE = 0; 75 76 79 80 public final static short SS_SUPER = 1; 81 82 85 86 public final static short SS_SUB = 2; 87 88 91 92 public final static byte U_NONE = 0; 93 94 97 98 public final static byte U_SINGLE = 1; 99 100 103 104 public final static byte U_DOUBLE = 2; 105 106 109 110 public final static byte U_SINGLE_ACCOUNTING = 0x21; 111 112 115 116 public final static byte U_DOUBLE_ACCOUNTING = 0x22; 117 private FontRecord font; 118 private short index; 119 120 121 122 protected HSSFFont(short index, FontRecord rec) 123 { 124 font = rec; 125 this.index = index; 126 } 127 128 133 134 public void setFontName(String name) 135 { 136 font.setFontName(name); 137 font.setFontNameLength(( byte ) name.length()); 138 } 139 140 145 146 public String getFontName() 147 { 148 return font.getFontName(); 149 } 150 151 156 157 public short getIndex() 158 { 159 return index; 160 } 161 162 168 169 public void setFontHeight(short height) 170 { 171 font.setFontHeight(height); 172 } 173 174 179 180 public void setFontHeightInPoints(short height) 181 { 182 font.setFontHeight(( short ) (height * 20)); 183 } 184 185 191 192 public short getFontHeight() 193 { 194 return font.getFontHeight(); 195 } 196 197 202 203 public short getFontHeightInPoints() 204 { 205 return ( short ) (font.getFontHeight() / 20); 206 } 207 208 212 213 public void setItalic(boolean italic) 214 { 215 font.setItalic(italic); 216 } 217 218 222 223 public boolean getItalic() 224 { 225 return font.isItalic(); 226 } 227 228 232 233 public void setStrikeout(boolean strikeout) 234 { 235 font.setStrikeout(strikeout); 236 } 237 238 242 243 public boolean getStrikeout() 244 { 245 return font.isStruckout(); 246 } 247 248 254 255 public void setColor(short color) 256 { 257 font.setColorPaletteIndex(color); 258 } 259 260 266 267 public short getColor() 268 { 269 return font.getColorPaletteIndex(); 270 } 271 272 278 279 public void setBoldweight(short boldweight) 280 { 281 font.setBoldWeight(boldweight); 282 } 283 284 290 291 public short getBoldweight() 292 { 293 return font.getBoldWeight(); 294 } 295 296 303 304 public void setTypeOffset(short offset) 305 { 306 font.setSuperSubScript(offset); 307 } 308 309 316 317 public short getTypeOffset() 318 { 319 return font.getSuperSubScript(); 320 } 321 322 331 332 public void setUnderline(byte underline) 333 { 334 font.setUnderline(underline); 335 } 336 337 346 347 public byte getUnderline() 348 { 349 return font.getUnderline(); 350 } 351 352 public String toString() 353 { 354 return "org.apache.poi.hssf.usermodel.HSSFFont{" + 355 font + 356 "}"; 357 } 358 359 360 } 361 | Popular Tags |