Package org.openxmlformats.schemas.spreadsheetml.x2006.main

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr


public class TestXSSFBorder extends TestCase {
 
  public void testGetBorderStyle() {
    CTStylesheet stylesheet = CTStylesheet.Factory.newInstance();
    CTBorder border = stylesheet.addNewBorders().addNewBorder();
    CTBorderPr top = border.addNewTop();
    CTBorderPr right = border.addNewRight();
    CTBorderPr bottom = border.addNewBottom();
    top.setStyle(STBorderStyle.DASH_DOT);
    right.setStyle(STBorderStyle.NONE);
    bottom.setStyle(STBorderStyle.THIN);
    XSSFCellBorder cellBorderStyle = new XSSFCellBorder(border);
    assertEquals("dashDot", cellBorderStyle.getBorderStyle(BorderSide.TOP).toString());
    assertEquals("none", cellBorderStyle.getBorderStyle(BorderSide.RIGHT).toString());
    assertEquals(1, cellBorderStyle.getBorderStyle(BorderSide.RIGHT).intValue());
    assertEquals("thin", cellBorderStyle.getBorderStyle(BorderSide.BOTTOM).toString());
View Full Code Here


     * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
     * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
     */
    public void setBorderBottom(short border) {
        CTBorder ct = getCTBorder();
        CTBorderPr pr = ct.isSetBottom() ? ct.getBottom() : ct.addNewBottom();
        if(border == BORDER_NONE) ct.unsetBottom();
        else pr.setStyle(STBorderStyle.Enum.forInt(border + 1));

        int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));

        _cellXf.setBorderId(idx);
        _cellXf.setApplyBorder(true);
View Full Code Here

     * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
     * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
     */
    public void setBorderLeft(short border) {
        CTBorder ct = getCTBorder();
        CTBorderPr pr = ct.isSetLeft() ? ct.getLeft() : ct.addNewLeft();
        if(border == BORDER_NONE) ct.unsetLeft();
        else pr.setStyle(STBorderStyle.Enum.forInt(border + 1));

        int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));

        _cellXf.setBorderId(idx);
        _cellXf.setApplyBorder(true);
View Full Code Here

     * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
     * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
     */
   public void setBorderRight(short border) {
        CTBorder ct = getCTBorder();
        CTBorderPr pr = ct.isSetRight() ? ct.getRight() : ct.addNewRight();
        if(border == BORDER_NONE) ct.unsetRight();
        else pr.setStyle(STBorderStyle.Enum.forInt(border + 1));

        int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));

        _cellXf.setBorderId(idx);
        _cellXf.setApplyBorder(true);
View Full Code Here

     * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_MEDIUM_DASH_DOT_DOT
     * @see org.apache.poi.ss.usermodel.CellStyle#BORDER_SLANTED_DASH_DOT
     */
   public void setBorderTop(short border) {
        CTBorder ct = getCTBorder();
        CTBorderPr pr = ct.isSetTop() ? ct.getTop() : ct.addNewTop();
        if(border == BORDER_NONE) ct.unsetTop();
        else pr.setStyle(STBorderStyle.Enum.forInt(border + 1));

        int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));

        _cellXf.setBorderId(idx);
        _cellXf.setApplyBorder(true);
View Full Code Here

     */
    public void setBottomBorderColor(XSSFColor color) {
        CTBorder ct = getCTBorder();
        if(color == null && !ct.isSetBottom()) return;

        CTBorderPr pr = ct.isSetBottom() ? ct.getBottom() : ct.addNewBottom();
        if(color != nullpr.setColor(color.getCTColor());
        else pr.unsetColor();

        int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));

        _cellXf.setBorderId(idx);
        _cellXf.setApplyBorder(true);
View Full Code Here

     */
    public void setLeftBorderColor(XSSFColor color) {
        CTBorder ct = getCTBorder();
        if(color == null && !ct.isSetLeft()) return;

        CTBorderPr pr = ct.isSetLeft() ? ct.getLeft() : ct.addNewLeft();
        if(color != nullpr.setColor(color.getCTColor());
        else pr.unsetColor();

        int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));

        _cellXf.setBorderId(idx);
        _cellXf.setApplyBorder(true);
View Full Code Here

     */
    public void setRightBorderColor(XSSFColor color) {
        CTBorder ct = getCTBorder();
        if(color == null && !ct.isSetRight()) return;

        CTBorderPr pr = ct.isSetRight() ? ct.getRight() : ct.addNewRight();
        if(color != nullpr.setColor(color.getCTColor());
        else pr.unsetColor();

        int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));

        _cellXf.setBorderId(idx);
        _cellXf.setApplyBorder(true);
View Full Code Here

     */
    public void setTopBorderColor(XSSFColor color) {
        CTBorder ct = getCTBorder();
        if(color == null && !ct.isSetTop()) return;

        CTBorderPr pr = ct.isSetTop() ? ct.getTop() : ct.addNewTop();
        if(color != nullpr.setColor(color.getCTColor());
        else pr.unsetColor();

        int idx = _stylesSource.putBorder(new XSSFCellBorder(ct));

        _cellXf.setBorderId(idx);
        _cellXf.setApplyBorder(true);
View Full Code Here

     * @param side -  - where to apply the color definition
     * @return borderstyle - the type of border to use. default value is NONE if border style is not set.
     * @see BorderStyle
     */
    public BorderStyle getBorderStyle(BorderSide side) {
        CTBorderPr ctBorder = getBorder(side);
        STBorderStyle.Enum border = ctBorder == null ? STBorderStyle.NONE : ctBorder.getStyle();
        return BorderStyle.values()[border.intValue() - 1];
    }
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBorderPr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.