List of usage examples for org.apache.poi.xssf.model StylesTable getCTStylesheet
@Internal
public CTStylesheet getCTStylesheet()
From source file:com.miraisolutions.xlconnect.XCellStyle.java
License:Open Source License
/** * Used for querying user-named cell styles (style xf only). * * @param workbook/*from w w w . j av a 2 s . c om*/ * @param name * @return XCellStyle with corresponding (named) style xf */ public static XCellStyle get(XSSFWorkbook workbook, String name) { StylesTable stylesSource = workbook.getStylesSource(); CTCellStyles ctCellStyles = stylesSource.getCTStylesheet().getCellStyles(); if (ctCellStyles != null) { for (int i = 0; i < ctCellStyles.getCount(); i++) { CTCellStyle ctCellStyle = ctCellStyles.getCellStyleArray(i); if (ctCellStyle.getName().equals(name)) { int styleXfId = (int) ctCellStyle.getXfId(); return new XCellStyle(workbook, -1, styleXfId); } } } return null; }