use of org.apache.poi.ss.usermodel.CellStyle in project Robot-Scouter by SUPERCILEX.
the class SpreadsheetCache method createColumnHeaderStyle.
private CellStyle createColumnHeaderStyle() {
CellStyle style = createBaseStyle();
style.setFont(createBaseHeaderFont());
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
return style;
}
use of org.apache.poi.ss.usermodel.CellStyle in project Robot-Scouter by SUPERCILEX.
the class SpreadsheetCache method getHeaderMetricRowHeaderStyle.
@Nullable
public CellStyle getHeaderMetricRowHeaderStyle() {
if (isUnsupportedDevice())
return null;
CellStyle rowHeaderStyle = createRowHeaderStyle();
Font font = createBaseHeaderFont();
font.setItalic(true);
font.setFontHeightInPoints((short) 14);
rowHeaderStyle.setFont(font);
return rowHeaderStyle;
}
use of org.apache.poi.ss.usermodel.CellStyle in project Robot-Scouter by SUPERCILEX.
the class SpreadsheetCache method setCellFormat.
public void setCellFormat(Cell cell, String format) {
if (isUnsupportedDevice())
return;
Short cachedFormat = mFormatStyles.get(format);
if (cachedFormat == null) {
cachedFormat = mWorkbook.createDataFormat().getFormat(format);
mFormatStyles.put(format, cachedFormat);
}
CellStyle style = mWorkbook.createCellStyle();
style.setDataFormat(cachedFormat);
cell.setCellStyle(style);
}
use of org.apache.poi.ss.usermodel.CellStyle in project tdi-studio-se by Talend.
the class ExcelTool method getPreCellStyle.
private CellStyle getPreCellStyle() {
if (preSheet != null && isAbsY && keepCellFormat) {
CellStyle preCellStyle = null;
if (preCell == null) {
preCellStyle = preSheet.getColumnStyle(curCell.getColumnIndex());
} else {
preCellStyle = preCell.getCellStyle();
}
CellStyle targetCellStyle = wb.createCellStyle();
targetCellStyle.cloneStyleFrom(preCellStyle);
return targetCellStyle;
} else {
return null;
}
}
use of org.apache.poi.ss.usermodel.CellStyle in project tdi-studio-se by Talend.
the class ExcelTool method getDateCellStyle.
private CellStyle getDateCellStyle(String pattern) {
CellStyle preCellStyle = getPreCellStyle();
if (preCellStyle == null) {
if (cellStylesMapping.get(pattern) != null) {
return cellStylesMapping.get(pattern);
} else {
CellStyle style = wb.createCellStyle();
if (font != null) {
style.setFont(font);
}
if (pattern != null || !"".equals(pattern)) {
style.setDataFormat(wb.getCreationHelper().createDataFormat().getFormat(pattern));
}
cellStylesMapping.put(pattern, style);
return style;
}
} else {
return preCellStyle;
}
}
Aggregations