XSSFWorkbook 设置字体颜色
时间: 2023-10-16 08:05:17 浏览: 208
Excel解析字体颜色
在XSSFWorkbook中设置字体颜色可以使用XSSFFont类的setColor方法。这个方法接受一个XSSFColor对象作为参数,而不是传入short类型的颜色值。为了正确设置字体颜色,需要使用XSSFColor类的构造函数来创建一个XSSFColor对象,并将其传递给setFont方法。注意,不需要调用XSSFColor的getIndexed方法。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [XSSFWorkbook 设置单元格样式_openpyxl3.0官方文档(25)—— 使用样式](https://blog.csdn.net/weixin_39943586/article/details/110232683)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [【原创】POI 5.x XSSF和HSSF使用自定义字体颜色](https://blog.csdn.net/DCTANT/article/details/125148737)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文