POI 设置Excel单元格背景色(参考颜色代码)

2023-05-16

// 创建一个 workbook 对象 
Workbook workbook = new XSSFWorkbook();
// 创建一个 sheet
Sheet sheet = workbook.createSheet();
//创建一行
Row row = sheet.createRow((short) 1);
CellStyle style = workbook.createCellStyle();
//关键点 IndexedColors.AQUA.getIndex() 对应颜色
style.setFillForegroundColor(***IndexedColors.AQUA.getIndex()***);
style.setFillPattern(CellStyle.SOLID_FOREGROUND);
Cell cell = row.createCell((short) 1);
cell.setCellValue("X1");
cell.setCellStyle(style);

图片对应位置:

å¨è¿éæå¥å¾çæè¿°

上面的单元格颜色对应下面的英语颜色表示,从X1-X49 按顺序对应;
将下面对应的code填入上述代码加粗斜体位置即可。
1.IndexedColors.AQUA.getIndex()
2.IndexedColors.AUTOMATIC.getIndex()
3.IndexedColors.BLUE.getIndex()
4.IndexedColors.BLUE_GREY.getIndex()
5.IndexedColors.BRIGHT_GREEN.getIndex()
6.IndexedColors.BROWN.getIndex()
7.IndexedColors.CORAL.getIndex()
8.IndexedColors.CORNFLOWER_BLUE.getIndex()
9.IndexedColors.DARK_BLUE.getIndex()
10.IndexedColors.DARK_GREEN.getIndex()
11.IndexedColors.DARK_RED.getIndex()
12.IndexedColors.DARK_TEAL.getIndex()
13.IndexedColors.DARK_YELLOW.getIndex()
14.IndexedColors.GOLD.getIndex()
15.IndexedColors.GREEN.getIndex()
16.IndexedColors.GREY_25_PERCENT.getIndex()
17.IndexedColors.GREY_40_PERCENT.getIndex()
18.IndexedColors.GREY_50_PERCENT.getIndex()
19.IndexedColors.GREY_80_PERCENT.getIndex()
20.IndexedColors.INDIGO.getIndex()
21.IndexedColors.LAVENDER.getIndex()
22.IndexedColors.LEMON_CHIFFON.getIndex()
23.IndexedColors.LIGHT_BLUE.getIndex()
24.IndexedColors.LEMON_CHIFFON.getIndex()
25.IndexedColors.LIGHT_BLUE.getIndex()
26.IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex()
27.IndexedColors.LIGHT_GREEN.getIndex()
28.IndexedColors.LIGHT_ORANGE.getIndex()
29.IndexedColors.LIGHT_TURQUOISE.getIndex()
30.IndexedColors.LIGHT_YELLOW.getIndex()
31.IndexedColors.LIME.getIndex()
32.IndexedColors.MAROON.getIndex()
33.IndexedColors.OLIVE_GREEN.getIndex()
34.IndexedColors.ORANGE.getIndex()
35.IndexedColors.ORCHID.getIndex()
36.IndexedColors.PALE_BLUE.getIndex()
37.IndexedColors.PINK.getIndex()
38.IndexedColors.PLUM.getIndex()
39.IndexedColors.RED.getIndex()
40.IndexedColors.ROSE.getIndex()
41.IndexedColors.ROYAL_BLUE.getIndex()
42.IndexedColors.SEA_GREEN.getIndex()
43.IndexedColors.SKY_BLUE.getIndex()
44.IndexedColors.TAN.getIndex()
45.IndexedColors.TEAL.getIndex()
46.IndexedColors.TURQUOISE.getIndex()
47.IndexedColors.VIOLET.getIndex()
48.IndexedColors.WHITE.getIndex()
49.IndexedColors.YELLOW.getIndex()

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

POI 设置Excel单元格背景色(参考颜色代码) 的相关文章

  • MSCKF2.0(Mingyang Li-IJRR2013) 论文要点总结

    论文 xff1a Li M Mourikis A I High precision consistent EKF based visual inertial odometry J The International Journal of R
  • SLAM,SLAM+IMU的状态估计问题描述-个人理解

    1 状态估计问题 令状态变量为x 61 x1 x2 x3 观测变量为z 61 z1 z2 z3 状态估计问题等同于求解条件概率分布 xff1a P x z xff0c 在当前观测状态z下的状态x分布 xff0c 也就是最可能的状态是什么 由
  • VINS-Fusion运行时的段错误(核心已转储)解决方法

    平台 ubuntu16 04 43 ROS 问题描述 xff1a 前两天VINS的原作者开源了VINS Fusion的双目版以及给出了和GPS融合的一个demo xff0c 所以试着运行下数据集 每次单目运行10s左右 xff0c 双目1
  • Jetson Xavier NX 刷机+更换清华源完美讲解

    当你拿到梦寐以求的NVIDIA Jetson Xavier NX开发板时 xff0c 第一个工作就是要刷机 究竟要怎么做呢 xff1f Let s go 这种板子有两种 xff0c 一种是带Micro SD卡槽的 xff0c 可以插入小型S
  • vmware下vmdk文件越来越大的解决方法探讨

    前段时间在vmware下面安装了ubuntu镜像 xff0c 用了一段时间后发现ubuntu的vmdk文件越来越大 xff0c 达到了31 6GB xff0c 如下图所示 而且随着继续安装新的软件仍然在增大中 即使在ubuntu里面删除了文
  • 工作日志的作用

    朱金灿 公司提倡我们每天都写工作日志 这使得我思考工作日志的作用 我想了一下 xff0c 工作日志应该要起两个作用 xff1a 1 计划作用 俗话说 xff1a 凡事预则立 xff0c 不预则废 最好在每天开始工作前先在工作日志上写下今天要
  • Tracealyzer for FreeRTOS(FreeRTOS+Trace) 详解(源码解析+移植)

    原文 xff1a http blog csdn net zcshoucsdn article details 54670473 最近公司搞新项目 xff0c 需要使用FreeRTOS xff0c 之前只有Linux的基础 xff08 学了个
  • 职场 | Intel因特尔2019届软件工程师秋招笔试题

    同样的本文是对笔试过程中 xff0c 仍然记得的考点的查漏补缺 一共分为三部分 xff1a 选择题 编程题 附加题 时间是两个小时 xff0c 个人感觉因特尔的笔试题对于内核 xff0c 内存管理等方面的考点较多 xff0c 具体属于什么科
  • Linux-LCD驱动实现

    一 帧缓冲设备驱动在Linux子系统中的结构 xff1a 二 帧缓冲相关的重要数据结构 从帧缓冲设备驱动程序结构 看 xff0c 该驱动主要跟fb info结构体有关 xff0c 该结构体记录了帧缓冲设备的全部信息 xff0c 包括设备的设
  • ROS之命名空间

    已经学ROS快两个月了 xff0c 一开始对ROS 命名空间 xff0c 参数 xff0c 参数服务器 xff0c 重映射没认真看 xff0c 后来发现很重要 xff0c 它是学习ROS代码的基础 我们都知道ros以topic通信 xff0
  • CircleProgressBar 一个界面漂亮功能强大的圆形进度条,支持多种属性

    CircleProgressBar 项目地址 xff1a HuTianQi CircleProgressBar 简介 xff1a 一个界面漂亮功能强大的圆形进度条 xff0c 支持多种属性 xff0c 如圆环的大小颜色 xff0c 进度条的
  • Android 串口调试助手

    Android SerialPort Tool 项目地址 xff1a licheedev Android SerialPort Tool 简介 xff1a Android 串口调试助手 更多 xff1a 作者 提 Bug 标签 xff1a
  • 树莓派IIC通讯获取BMI08x IMU数据进行姿态解算,并通过UART/TCP在rviz上显示

    截至2021年 xff0c 树莓派出的最新款应该是Raspberry Pi 400 xff0c 设计得跟键盘一样 xff0c 很难想象到这是个树莓派 xff0c 尤其是它的标语写的很好 你的下一个电脑 xff0c 何必是电脑 xff0c 不
  • 运用ROS和OpenCV进行简单的图像处理之检测

    本文主要讲述在ROS下使用opencv进行图像处理 xff0c 并给出了一个详细示例 首先建立一个ros包 xff0c 在CMakeLists txt中加入以下代码段 xff0c 用于找到并链接OpenCV 安装完整版的ROS会顺带把Ope
  • ROS工程中C++调用python函数

    在ROS api程序中 xff0c 大部分函数的实现是用的python xff0c python语言简单易学 xff0c 特别做一些测试和调试非常简单 因此 xff0c 在C 43 43 中调用python函数会极大地减少工作量 在C 43
  • Cleanup failed to process the following paths错误的解决

    作者 xff1a 朱金灿 来源 xff1a http blog csdn net clever101 在使用TortoiseSVN工具执行Cleanup操作时经常出现Cleanup failed to process the followi
  • json字符串、json对象、数组 三者之间的转换

    json字符串 json对象 数组 三者之间的转换 lt script gt json字符串 json对象 数组 三者之间的转换 let jsonStr 61 39 34 id 34 34 01 34 34 open 34 false 34
  • 嵌入式开发之Vscode实用插件大全

    嵌入式开发之Vscode实用插件大全 Chinese Simplified 简体中文 xff08 神器 xff09 C C 43 43 amp CMake amp C C 43 43 Extension Pack xff08 神器 xff0
  • 海康卫视web3.0遇到的问题总结。

    一 Uncaught DOMException Failed to execute open on XMLHttpRequest Invalid URL 解决办法 xff1a 启动一个静态文件服务器 例如 xff1a 1 npm insta
  • fwrite写入文件乱码问题

    参考下面这篇文章 xff08 使用fprintf写入文件 xff09 http c biancheng net cpp html 2936 html 使用fprintf 和 fscanf 代替 fwrite fscanf 和 fprintf

随机推荐