Apache POI getFontIndex : incompatible types: possible lossy conversion from int to short

Viewed 40

I migrate Apache POI from 3.17 to 5.2.2.

The code below produces an error "incompatible types: possible lossy conversion from int to short" in compile step on third line and I don't understand why because getFontIndex return a short and getFontAt take a short too.

Can you help me please ?

Workbook wb = sheet.getWorkbook();
CellStyle cellStyle = longestTextCell.getCellStyle();
short fontIndex = cellStyle.getFontIndex();
Font excelFont = wb.getFontAt(fontIndex);

PS : fontIndex is not used elsewhere.

0 Answers
Related