Example usage for org.apache.poi.xwpf.usermodel Borders getValue

List of usage examples for org.apache.poi.xwpf.usermodel Borders getValue

Introduction

In this page you can find the example usage for org.apache.poi.xwpf.usermodel Borders getValue.

Prototype

public int getValue() 

Source Link

Usage

From source file:apachepoitest.XWPFParagraphClone.java

License:Apache License

/**
 * Specifies the border which shall be displayed above a set of paragraphs
 * which have the same set of paragraph border settings.
 * <p/>/*from w  ww.  jav  a  2 s .co m*/
 * <p/>
 * To determine if any two adjoining paragraphs shall have an individual top
 * and bottom border or a between border, the set of borders on the two
 * adjoining paragraphs are compared. If the border information on those two
 * paragraphs is identical for all possible paragraphs borders, then the
 * between border is displayed. Otherwise, the final paragraph shall use its
 * bottom border and the following paragraph shall use its top border,
 * respectively. If this border specifies a space attribute, that value
 * determines the space above the text (ignoring any spacing above) which
 * should be left before this border is drawn, specified in points.
 * </p>
 * <p/>
 * If this element is omitted on a given paragraph, its value is determined
 * by the setting previously set at any level of the style hierarchy (i.e.
 * that previous setting remains unchanged). If this setting is never
 * specified in the style hierarchy, then no between border shall be applied
 * above identical paragraphs.
 * </p>
 * <b>This border can only be a line border.</b>
 *
 * @param border
 * @see Borders for a list of all types of borders
 */
public void setBorderTop(Borders border) {
    CTPBdr ct = getCTPBrd(true);
    if (ct == null) {
        throw new RuntimeException("invalid paragraph state");
    }

    CTBorder pr = (ct.isSetTop()) ? ct.getTop() : ct.addNewTop();
    if (border.getValue() == Borders.NONE.getValue())
        ct.unsetTop();
    else
        pr.setVal(STBorder.Enum.forInt(border.getValue()));
}

From source file:apachepoitest.XWPFParagraphClone.java

License:Apache License

/**
 * Specifies the border which shall be displayed below a set of paragraphs
 * which have the same set of paragraph border settings.
 * <p/>// w  w  w.j a  v a  2s  .c o m
 * To determine if any two adjoining paragraphs shall have an individual top
 * and bottom border or a between border, the set of borders on the two
 * adjoining paragraphs are compared. If the border information on those two
 * paragraphs is identical for all possible paragraphs borders, then the
 * between border is displayed. Otherwise, the final paragraph shall use its
 * bottom border and the following paragraph shall use its top border,
 * respectively. If this border specifies a space attribute, that value
 * determines the space after the bottom of the text (ignoring any space
 * below) which should be left before this border is drawn, specified in
 * points.
 * </p>
 * <p/>
 * If this element is omitted on a given paragraph, its value is determined
 * by the setting previously set at any level of the style hierarchy (i.e.
 * that previous setting remains unchanged). If this setting is never
 * specified in the style hierarchy, then no between border shall be applied
 * below identical paragraphs.
 * </p>
 * <b>This border can only be a line border.</b>
 *
 * @param border
 * @see Borders a list of all types of borders
 */
public void setBorderBottom(Borders border) {
    CTPBdr ct = getCTPBrd(true);
    CTBorder pr = ct.isSetBottom() ? ct.getBottom() : ct.addNewBottom();
    if (border.getValue() == Borders.NONE.getValue())
        ct.unsetBottom();
    else
        pr.setVal(STBorder.Enum.forInt(border.getValue()));
}

From source file:apachepoitest.XWPFParagraphClone.java

License:Apache License

/**
 * Specifies the border which shall be displayed on the left side of the
 * page around the specified paragraph./*from www .j a  v  a 2 s .c o  m*/
 * <p/>
 * To determine if any two adjoining paragraphs should have a left border
 * which spans the full line height or not, the left border shall be drawn
 * between the top border or between border at the top (whichever would be
 * rendered for the current paragraph), and the bottom border or between
 * border at the bottom (whichever would be rendered for the current
 * paragraph).
 * </p>
 * <p/>
 * If this element is omitted on a given paragraph, its value is determined
 * by the setting previously set at any level of the style hierarchy (i.e.
 * that previous setting remains unchanged). If this setting is never
 * specified in the style hierarchy, then no left border shall be applied.
 * </p>
 * <b>This border can only be a line border.</b>
 *
 * @param border
 * @see Borders for a list of all possible borders
 */
public void setBorderLeft(Borders border) {
    CTPBdr ct = getCTPBrd(true);
    CTBorder pr = ct.isSetLeft() ? ct.getLeft() : ct.addNewLeft();
    if (border.getValue() == Borders.NONE.getValue())
        ct.unsetLeft();
    else
        pr.setVal(STBorder.Enum.forInt(border.getValue()));
}

From source file:apachepoitest.XWPFParagraphClone.java

License:Apache License

/**
 * Specifies the border which shall be displayed on the right side of the
 * page around the specified paragraph./*ww w  . j a  v a 2 s  .  co  m*/
 * <p/>
 * To determine if any two adjoining paragraphs should have a right border
 * which spans the full line height or not, the right border shall be drawn
 * between the top border or between border at the top (whichever would be
 * rendered for the current paragraph), and the bottom border or between
 * border at the bottom (whichever would be rendered for the current
 * paragraph).
 * </p>
 * <p/>
 * If this element is omitted on a given paragraph, its value is determined
 * by the setting previously set at any level of the style hierarchy (i.e.
 * that previous setting remains unchanged). If this setting is never
 * specified in the style hierarchy, then no right border shall be applied.
 * </p>
 * <b>This border can only be a line border.</b>
 *
 * @param border
 * @see Borders for a list of all possible borders
 */
public void setBorderRight(Borders border) {
    CTPBdr ct = getCTPBrd(true);
    CTBorder pr = ct.isSetRight() ? ct.getRight() : ct.addNewRight();
    if (border.getValue() == Borders.NONE.getValue())
        ct.unsetRight();
    else
        pr.setVal(STBorder.Enum.forInt(border.getValue()));
}

From source file:apachepoitest.XWPFParagraphClone.java

License:Apache License

/**
 * Specifies the border which shall be displayed between each paragraph in a
 * set of paragraphs which have the same set of paragraph border settings.
 * <p/>/*  w w  w  .j ava  2  s . com*/
 * To determine if any two adjoining paragraphs should have a between border
 * or an individual top and bottom border, the set of borders on the two
 * adjoining paragraphs are compared. If the border information on those two
 * paragraphs is identical for all possible paragraphs borders, then the
 * between border is displayed. Otherwise, each paragraph shall use its
 * bottom and top border, respectively. If this border specifies a space
 * attribute, that value is ignored - this border is always located at the
 * bottom of each paragraph with an identical following paragraph, taking
 * into account any space after the line pitch.
 * </p>
 * <p/>
 * If this element is omitted on a given paragraph, its value is determined
 * by the setting previously set at any level of the style hierarchy (i.e.
 * that previous setting remains unchanged). If this setting is never
 * specified in the style hierarchy, then no between border shall be applied
 * between identical paragraphs.
 * </p>
 * <b>This border can only be a line border.</b>
 *
 * @param border
 * @see Borders for a list of all possible borders
 */
public void setBorderBetween(Borders border) {
    CTPBdr ct = getCTPBrd(true);
    CTBorder pr = ct.isSetBetween() ? ct.getBetween() : ct.addNewBetween();
    if (border.getValue() == Borders.NONE.getValue())
        ct.unsetBetween();
    else
        pr.setVal(STBorder.Enum.forInt(border.getValue()));
}