public void setFillPattern(short fp){ CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill(); if(fp == NO_FILL) ptrn.unsetPatternType(); else ptrn.setPatternType(STPatternType.Enum.forInt(fp + 1)); } }
public String getXpath(){ CTXmlCellPr xmlCellPr = singleXmlCell.getXmlCellPr(); CTXmlPr xmlPr = xmlCellPr.getXmlPr(); return xmlPr.getXpath(); }
public CommentsTable() { super(); comments = CTComments.Factory.newInstance(); comments.addNewCommentList(); comments.addNewAuthors().addAuthor(DEFAULT_AUTHOR); }
private void setFillForegroundColor(CTColor color) { CTPatternFill ptrn = _fill.isSetPatternFill() ? _fill.getPatternFill() : _fill.addNewPatternFill(); if (color == null) { ptrn.unsetFgColor(); } else { ptrn.setFgColor(color); } }
public void setBottomBorderColor(CTColor color) { CTBorderPr pr = _border.isSetBottom() ? _border.getBottom() : _border.addNewBottom(); if (color == null) { pr.unsetColor(); } else { pr.setColor(color); } }
public void setLeftBorderColor(CTColor color) { CTBorderPr pr = _border.isSetLeft() ? _border.getLeft() : _border.addNewLeft(); if (color == null) { pr.unsetColor(); } else { pr.setColor(color); } }
public Enum getXmlDataType() { CTXmlCellPr xmlCellPr = singleXmlCell.getXmlCellPr(); CTXmlPr xmlPr = xmlCellPr.getXmlPr(); return xmlPr.getXmlDataType(); }
private CTSheet addSheet(String sheetname) { CTSheet sheet = workbook.getSheets().addNewSheet(); sheet.setName(sheetname); return sheet; }
private static CTFill[] createDefaultFills() { CTFill[] ctFill = new CTFill[]{CTFill.Factory.newInstance(),CTFill.Factory.newInstance()}; ctFill[0].addNewPatternFill().setPatternType(STPatternType.NONE); ctFill[1].addNewPatternFill().setPatternType(STPatternType.DARK_GRAY); return ctFill; }
/** * get the color value for the font * References a color defined in theme. * * @return short - theme defined to use */ public short getThemeColor() { CTColor color = _ctFont.sizeOfColorArray() == 0 ? null : _ctFont.getColorArray(0); long index = color == null ? 0 : color.getTheme(); return (short) index; }
/** * Convenience method to get the active sheet. The active sheet is is the sheet * which is currently displayed when the workbook is viewed in Excel. * 'Selected' sheet(s) is a distinct concept. */ @Override public int getActiveSheetIndex() { //activeTab (Active Sheet Index) Specifies an unsignedInt //that contains the index to the active sheet in this book view. return (int)workbook.getBookViews().getWorkbookViewArray(0).getActiveTab(); }
protected CTSheetFormatPr getSheetTypeSheetFormatPr() { if (dialogsheet.getSheetFormatPr() == null) { dialogsheet.setSheetFormatPr(CTSheetFormatPr.Factory.newInstance()); } return dialogsheet.getSheetFormatPr(); }
/** * get the name of the font (i.e. Arial) * * @return String - a string representing the name of the font to use */ public String getFontName() { CTFontName name = _ctFont.sizeOfNameArray() == 0 ? null : _ctFont.getNameArray(0); return name == null ? DEFAULT_FONT_NAME : name.getVal(); }
/** * @param color font color index */ @Override public void setFontColorIndex(short color){ _font.setColorArray(null); if(color != -1){ _font.addNewColor().setIndexed(color); } }
/** * get whether the font weight is set to bold or not * * @return bold - whether the font is bold or not */ @Override public boolean isBold(){ return _font.sizeOfBArray() == 1 && _font.getBArray(0).getVal(); }
private boolean columnExists(CTCols cols, long min, long max) { for (CTCol col : cols.getColList()) { if (col.getMin() == min && col.getMax() == max) { return true; } } return false; }
/** * Sets the first tab that is displayed in the list of tabs in excel. * * @param index integer that contains the index to the active sheet in this book view. */ @Override public void setFirstVisibleTab(int index) { CTBookViews bookViews = workbook.getBookViews(); CTBookView bookView= bookViews.getWorkbookViewArray(0); bookView.setFirstSheet(index); }
/** * Determine whether printed output for this sheet will be horizontally centered. */ @Override public boolean getHorizontallyCenter() { CTPrintOptions opts = worksheet.getPrintOptions(); return opts != null && opts.getHorizontalCentered(); }
/** * set font style options to default values (non-italic, non-bold) */ @Override public void resetFontStyle(){ _font.set(CTFont.Factory.newInstance()); } }
public int getIndexOfColumn(CTCols cols, CTCol searchCol) { if (cols == null || searchCol == null) return -1; int i = 0; for (CTCol col : cols.getColList()) { if (col.getMin() == searchCol.getMin() && col.getMax() == searchCol.getMax()) { return i; } i++; } return -1; } }