gpt4 book ai didi

java - jxl 将字体设置为日期类型单元格

转载 作者:行者123 更新时间:2023-11-30 03:53:44 26 4
gpt4 key购买 nike

我正在使用 jxl 创建 Excel 文件。我需要为日期类型单元格设置特定字体。当我编写文本单元格时,很容易做到:

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

但是当我使用以下代码创建日期单元格时,我不知道如何设置字体:

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

感谢您的帮助!

最佳答案

这是一个老问题,但如果其他人来这里寻找此信息,则值得回答:

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

关于java - jxl 将字体设置为日期类型单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23779145/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com