/** * gets the font for this style * @param parentWorkbook The HSSFWorkbook that this style belongs to * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndexAsInt() * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(int) */ public HSSFFont getFont(org.apache.poi.ss.usermodel.Workbook parentWorkbook) { return ((HSSFWorkbook) parentWorkbook).getFontAt(getFontIndexAsInt()); }
public void cloneStyleFrom(HSSFCellStyle source) { // First we need to clone the extended format // record _format.cloneStyleFrom(source._format); // Handle matching things if we cross workbooks if(_workbook != source._workbook) { lastDateFormat.set(Short.MIN_VALUE); lastFormats.set(null); getDataFormatStringCache.set(null); // Then we need to clone the format string, // and update the format record for this short fmt = (short)_workbook.createFormat(source.getDataFormatString() ); setDataFormat(fmt); // Finally we need to clone the font, // and update the format record for this FontRecord fr = _workbook.createNewFont(); fr.cloneStyleFrom( source._workbook.getFontRecordAt( source.getFontIndexAsInt() ) ); HSSFFont font = new HSSFFont( (short)_workbook.getFontIndex(fr), fr ); setFont(font); } }
/** * gets the font for this style * @param parentWorkbook The HSSFWorkbook that this style belongs to * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndexAsInt() * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(int) */ public HSSFFont getFont(org.apache.poi.ss.usermodel.Workbook parentWorkbook) { return ((HSSFWorkbook) parentWorkbook).getFontAt(getFontIndexAsInt()); }
public void cloneStyleFrom(HSSFCellStyle source) { // First we need to clone the extended format // record _format.cloneStyleFrom(source._format); // Handle matching things if we cross workbooks if(_workbook != source._workbook) { lastDateFormat.set(Short.MIN_VALUE); lastFormats.set(null); getDataFormatStringCache.set(null); // Then we need to clone the format string, // and update the format record for this short fmt = (short)_workbook.createFormat(source.getDataFormatString() ); setDataFormat(fmt); // Finally we need to clone the font, // and update the format record for this FontRecord fr = _workbook.createNewFont(); fr.cloneStyleFrom( source._workbook.getFontRecordAt( source.getFontIndexAsInt() ) ); HSSFFont font = new HSSFFont( (short)_workbook.getFontIndex(fr), fr ); setFont(font); } }
if (cell != null) { HSSFCellStyle style = cell.getCellStyle(); HSSFFont f = wb.getFontAt(style.getFontIndexAsInt()); boolean isbold = f.getBold(); boolean isitalics = f.getItalic();
HSSFFont f = wb.getFontAt(s.getFontIndexAsInt()); setFont(SVTableUtils.makeFont(f));