This project is read-only.

why font can not be set to bold

Jul 15, 2012 at 6:54 AM


I want to set font for header different to bold. I use

            HSSFCellStyle style = (HSSFCellStyle)workbook.CreateCellStyle();
            HSSFFont font = (HSSFFont)workbook.CreateFont();
            font.Boldweight = HSSFFont.BOLDWEIGHT_BOLD;

But on line 3 it gives error "Error    7    'NPOI.HSSF.UserModel.HSSFFont' does not contain a definition for 'BOLDWEIGHT_BOLD' ". Please help. Thanks.

Aug 24, 2012 at 7:07 PM
Edited Aug 24, 2012 at 7:09 PM
If you're using v1.2.5, try this:
font.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.BOLD;