Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

POI 3.17 bold font

I'm upgrading from POI 3.15 to 3.17

This code does not compile:

HSSFFont fontTitle = wb.createFont();
fontTitle.setFontHeightInPoints((short) 12);
fontTitle.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

I've changed to:

Font fontTitle = wb.createFont();
fontTitle.setFontHeightInPoints((short) 12);
fontTitle.setBoldweight(Font.BOLDWEIGHT_BOLD);

but still in error:

/excel/SQL2XLSX17N.java:271: cannot find symbol               
symbol  : variable BOLDWEIGHT_BOLD                            
location: interface org.apache.poi.ss.usermodel.Font          
               fontTitle.setBoldweight(Font.BOLDWEIGHT_BOLD); 

How do I use a bold font?

like image 440
beppecosta Avatar asked Nov 28 '22 08:11

beppecosta


1 Answers

Use Font.setBold(true) to embolden.

Signature:

void setBold(boolean bold)
like image 56
Stephen Kennedy Avatar answered Dec 05 '22 18:12

Stephen Kennedy