How to set the style of a row, not the style of individual cells?

Feb 16, 2016 at 11:13 PM
I'd like to set the first row on my sheet to Bold. Sounds dangerously easy, but when I set row.RowStyle it's not applied to the cells I add to that row. i.e. I open the resulting workbook and the font is not bold. BUT the font of later cells in the row ARE bold, i.e. if I type in Excel into blank cells in the row to the right of ones created in code they are formatted in bold. What's going on here, am I creating the cells incorrectly or do they just not inherit the formatting of the row?
            var workbook = new XSSFWorkbook();
            var sheet = workbook.CreateSheet("Requests");
            IDataFormat format = workbook.CreateDataFormat();

            // Write header row
            var rowNum = 0;
            var row = sheet.CreateRow(rowNum++);
            var col = 0;

            var rowstyle = workbook.CreateCellStyle();
            var boldFont = workbook.CreateFont();
            boldFont.Boldweight = (short)FontBoldWeight.Bold;
            rowstyle.SetFont(boldFont);
            row.RowStyle = rowstyle;

            row.CreateCell(col++).SetCellValue("Id");
            row.CreateCell(col++).SetCellValue("Status");
            row.CreateCell(col++).SetCellValue("Title");
I see various other questions about this on stackoverflow (here, here, here) but no answers other than applying the same style to each cell. Doesn't that almost defeat the purpose of having RowStyle?

thanks,

Rory