如何申请背景颜色使用Apache POI在Excel工作表中的行? [英] How to apply background color for the rows in excel sheet using Apache POI?

查看:140
本文介绍了如何申请背景颜色使用Apache POI在Excel工作表中的行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Apache POI将数据导出到Excel表。它工作正常。问题是我需要申请的黄色背景色几行中的excel表,同时生成excel表。请HELLP我如何申请背景颜色Excel工作表的行同时产生。

I am using Apache POI for exporting data into excel sheet. it works fine. the problem is i need apply yellow background color for few rows in the excel sheet while generating the excel sheet. please hellp me how to apply background color for the rows of excel sheet while generating.

谢谢,
雷迪

推荐答案

直接从官方指导价:

    // Aqua background
CellStyle style = wb.createCellStyle();
style.setFillBackgroundColor(IndexedColors.AQUA.getIndex());
style.setFillPattern(CellStyle.BIG_SPOTS);
row.setRowStyle(style);

这篇关于如何申请背景颜色使用Apache POI在Excel工作表中的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆