Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 16 17 18 package org.apache.poi.hssf.usermodel; 19 20 import org.apache.poi.hssf.record.ExtendedFormatRecord; 21 22 33 34 public class HSSFCellStyle 35 { 36 private ExtendedFormatRecord format = null; 37 private short index = 0; 38 private short fontindex = 0; 39 40 43 44 public final static short ALIGN_GENERAL = 0x0; 45 46 49 50 public final static short ALIGN_LEFT = 0x1; 51 52 55 56 public final static short ALIGN_CENTER = 0x2; 57 58 61 62 public final static short ALIGN_RIGHT = 0x3; 63 64 67 68 public final static short ALIGN_FILL = 0x4; 69 70 73 74 public final static short ALIGN_JUSTIFY = 0x5; 75 76 79 80 public final static short ALIGN_CENTER_SELECTION = 0x6; 81 82 85 86 public final static short VERTICAL_TOP = 0x0; 87 88 91 92 public final static short VERTICAL_CENTER = 0x1; 93 94 97 98 public final static short VERTICAL_BOTTOM = 0x2; 99 100 103 104 public final static short VERTICAL_JUSTIFY = 0x3; 105 106 109 110 public final static short BORDER_NONE = 0x0; 111 112 115 116 public final static short BORDER_THIN = 0x1; 117 118 121 122 public final static short BORDER_MEDIUM = 0x2; 123 124 127 128 public final static short BORDER_DASHED = 0x3; 129 130 133 134 public final static short BORDER_HAIR = 0x4; 135 136 139 140 public final static short BORDER_THICK = 0x5; 141 142 145 146 public final static short BORDER_DOUBLE = 0x6; 147 148 151 152 public final static short BORDER_DOTTED = 0x7; 153 154 157 158 public final static short BORDER_MEDIUM_DASHED = 0x8; 159 160 163 164 public final static short BORDER_DASH_DOT = 0x9; 165 166 169 170 public final static short BORDER_MEDIUM_DASH_DOT = 0xA; 171 172 175 176 public final static short BORDER_DASH_DOT_DOT = 0xB; 177 178 181 182 public final static short BORDER_MEDIUM_DASH_DOT_DOT = 0xC; 183 184 187 188 public final static short BORDER_SLANTED_DASH_DOT = 0xD; 189 190 191 public final static short NO_FILL = 0 ; 192 193 public final static short SOLID_FOREGROUND = 1 ; 194 195 public final static short FINE_DOTS = 2 ; 196 197 public final static short ALT_BARS = 3 ; 198 199 public final static short SPARSE_DOTS = 4 ; 200 201 public final static short THICK_HORZ_BANDS = 5 ; 202 203 public final static short THICK_VERT_BANDS = 6 ; 204 205 public final static short THICK_BACKWARD_DIAG = 7 ; 206 207 public final static short THICK_FORWARD_DIAG = 8 ; 208 209 public final static short BIG_SPOTS = 9 ; 210 211 public final static short BRICKS = 10 ; 212 213 public final static short THIN_HORZ_BANDS = 11 ; 214 215 public final static short THIN_VERT_BANDS = 12 ; 216 217 public final static short THIN_BACKWARD_DIAG = 13 ; 218 219 public final static short THIN_FORWARD_DIAG = 14 ; 220 221 public final static short SQUARES = 15 ; 222 223 public final static short DIAMONDS = 16 ; 224 225 226 227 228 protected HSSFCellStyle(short index, ExtendedFormatRecord rec) 229 { 230 this.index = index; 231 format = rec; 232 } 233 234 239 240 public short getIndex() 241 { 242 return index; 243 } 244 245 249 250 public void setDataFormat(short fmt) 251 { 252 format.setFormatIndex(fmt); 253 } 254 255 259 260 public short getDataFormat() 261 { 262 return format.getFormatIndex(); 263 } 264 265 271 272 public void setFont(HSSFFont font) 273 { 274 format.setIndentNotParentFont(true); 275 fontindex = font.getIndex(); 276 format.setFontIndex(fontindex); 277 } 278 279 public short getFontIndex() 280 { 281 return format.getFontIndex(); 282 } 283 284 288 289 public void setHidden(boolean hidden) 290 { 291 format.setIndentNotParentCellOptions(true); 292 format.setHidden(hidden); 293 } 294 295 299 300 public boolean getHidden() 301 { 302 return format.isHidden(); 303 } 304 305 309 310 public void setLocked(boolean locked) 311 { 312 format.setIndentNotParentCellOptions(true); 313 format.setLocked(locked); 314 } 315 316 320 321 public boolean getLocked() 322 { 323 return format.isLocked(); 324 } 325 326 337 338 public void setAlignment(short align) 339 { 340 format.setIndentNotParentAlignment(true); 341 format.setAlignment(align); 342 } 343 344 355 356 public short getAlignment() 357 { 358 return format.getAlignment(); 359 } 360 361 366 367 372 377 378 383 387 388 public void setWrapText(boolean wrapped) 389 { 390 format.setIndentNotParentAlignment(true); 391 format.setWrapText(wrapped); 392 } 393 394 398 399 public boolean getWrapText() 400 { 401 return format.getWrapText(); 402 } 403 404 412 413 public void setVerticalAlignment(short align) 414 { 415 format.setVerticalAlignment(align); 416 } 417 418 426 427 public short getVerticalAlignment() 428 { 429 return format.getVerticalAlignment(); 430 } 431 432 436 437 public void setRotation(short rotation) 438 { 439 if ((rotation < 0)&&(rotation >= -90)) { 440 rotation = (short)(90 - rotation); 443 } 444 else if ((rotation < -90) ||(rotation > 90)) 445 throw new IllegalArgumentException ("The rotation must be between -90 and 90 degrees"); 447 format.setRotation(rotation); 448 } 449 450 454 455 public short getRotation() 456 { 457 short rotation = format.getRotation(); 458 if (rotation > 90) 459 rotation = (short)(90-rotation); 461 return rotation; 462 } 463 464 468 469 public void setIndention(short indent) 470 { 471 format.setIndent(indent); 472 } 473 474 478 479 public short getIndention() 480 { 481 return format.getIndent(); 482 } 483 484 502 503 public void setBorderLeft(short border) 504 { 505 format.setIndentNotParentBorder(true); 506 format.setBorderLeft(border); 507 } 508 509 527 528 public short getBorderLeft() 529 { 530 return format.getBorderLeft(); 531 } 532 533 551 552 public void setBorderRight(short border) 553 { 554 format.setIndentNotParentBorder(true); 555 format.setBorderRight(border); 556 } 557 558 576 577 public short getBorderRight() 578 { 579 return format.getBorderRight(); 580 } 581 582 600 601 public void setBorderTop(short border) 602 { 603 format.setIndentNotParentBorder(true); 604 format.setBorderTop(border); 605 } 606 607 625 626 public short getBorderTop() 627 { 628 return format.getBorderTop(); 629 } 630 631 649 650 public void setBorderBottom(short border) 651 { 652 format.setIndentNotParentBorder(true); 653 format.setBorderBottom(border); 654 } 655 656 674 675 public short getBorderBottom() 676 { 677 return format.getBorderBottom(); 678 } 679 680 684 685 public void setLeftBorderColor(short color) 686 { 687 format.setLeftBorderPaletteIdx(color); 688 } 689 690 694 695 public short getLeftBorderColor() 696 { 697 return format.getLeftBorderPaletteIdx(); 698 } 699 700 704 705 public void setRightBorderColor(short color) 706 { 707 format.setRightBorderPaletteIdx(color); 708 } 709 710 714 715 public short getRightBorderColor() 716 { 717 return format.getRightBorderPaletteIdx(); 718 } 719 720 724 725 public void setTopBorderColor(short color) 726 { 727 format.setTopBorderPaletteIdx(color); 728 } 729 730 734 735 public short getTopBorderColor() 736 { 737 return format.getTopBorderPaletteIdx(); 738 } 739 740 744 745 public void setBottomBorderColor(short color) 746 { 747 format.setBottomBorderPaletteIdx(color); 748 } 749 750 754 755 public short getBottomBorderColor() 756 { 757 return format.getBottomBorderPaletteIdx(); 758 } 759 760 784 public void setFillPattern(short fp) 785 { 786 format.setAdtlFillPattern(fp); 787 } 788 789 793 794 public short getFillPattern() 795 { 796 return format.getAdtlFillPattern(); 797 } 798 799 817 818 public void setFillBackgroundColor(short bg) 819 { 820 format.setFillBackground(bg); 821 } 822 823 827 828 public short getFillBackgroundColor() 829 { 830 return format.getFillBackground(); 831 } 832 833 837 838 public void setFillForegroundColor(short bg) 839 { 840 format.setFillForeground(bg); 841 } 842 843 847 848 public short getFillForegroundColor() 849 { 850 return format.getFillForeground(); 851 } 852 853 } 854
| Popular Tags
|