Setting the font color for XSSFWorkbook?

Apr 7, 2014 at 2:20 PM
I've been trying to get npoi to set the color on rich text using the xssf library and haven't been having any luck. What am I doing wrong? Thanks.
static void Main(string[] args)
{
    XSSFWorkbook wb = new XSSFWorkbook();

    ISheet sheet = wb.CreateSheet();

    IRow row = sheet.CreateRow(0);

    XSSFFont font = wb.CreateFont() as XSSFFont;
    font.SetColor(new XSSFColor(System.Drawing.Color.Aquamarine));

    XSSFRichTextString text = new XSSFRichTextString("some text");
    text.ApplyFont(0, 3, font);

    XSSFCell cell = row.CreateCell(0) as XSSFCell;
    cell.SetCellValue(text);

    using (FileStream fs = new FileStream("test.xlsx", FileMode.Create, FileAccess.Write))
        wb.Write(fs);

    Process.Start("test.xlsx");            
}