Silvio
Silvio

Reputation: 123

jxl set font to date type cell

I'm using jxl to create excel files. I need to set a particular font for date type cells. When I write a text cell it's easy to do:

WritableFont arial10pt = new WritableFont(WritableFont.ARIAL, 10);
    arial = new WritableCellFormat(arial10pt);

But when I create a date cell, using the following code, I don't know how to set a font:

DateFormat customDateFormat = new DateFormat("dd/MM/yyyy");
    WritableCellFormat dateFormat = new WritableCellFormat(customDateFormat);

Thanks for help!

Upvotes: 1

Views: 1084

Answers (1)

jmf1205
jmf1205

Reputation: 447

This is an old question, but worth an answer should anyone else get here in search of this info:

WritableFont arial10pt = new WritableFont(WritableFont.ARIAL, 10);
arial = new WritableCellFormat(arial10pt);
DateFormat customDateFormat = new DateFormat("dd/MM/yyyy");
WritableCellFormat dateFormat = new WritableCellFormat(arial10pt,customDateFormat);

Upvotes: 2

Related Questions