乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > java 关于<em>poi</em>读取<em>excel</em>颜

java 关于<em>poi</em>读取<em>excel</em>颜

作者:乔山办公网日期:

返回目录:excel表格制作


使用 poi ,具体实现
HSSFCellStyle style = null;
// 创建表头7a64e58685e5aeb9364style
HSSFCellStyle cellStyleTitle = workbook.createCellStyle();
cellStyleTitle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); // 填充单元格
cellStyleTitle.setFillForegroundColor(HSSFColor.YELLOW.index);
cellStyleTitle.setAlignment(HSSFCellStyle.ALIGN_CENTER);// //居中显示

HSSFRow titleRow = sheet.createRow(0);
for (int i = 0; i < titles.length; i++) {
HSSFCell cell = titleRow.createCell(i);
// cell.setCellStyle(createCellColorStyle(workbook));
cell.setCellStyle(cellStyleTitle);
cell.setCellValue(titles[i]);// 给单元格赋值
}

不知道能,看懂不,如果有不清楚的私聊

比如这些数据zd在A1:G9,在I2输入公式=MODE(IF(COUNTIF($I$1:I1,$A$1:$G$9)=0,$A$1:$G$9))数组公式,公式在编辑状态下按CTRL+SHIFT+ENTER结束,公式向下复制到I4。
使用poi jar包
HSSFCellStyle style = workbook.createCellStyle();
style.getFillForegroundColor(); 追问我想取的代码出来的效果类似0x0000ff这种的颜色代码,能取到吗?
因为我想将颜色展现到cell,但是cell能接受就是这种代码,能有办法吗

主要是数据类型转换上的问题(int)(value.charAt(j))。vakue.charAt()取到的是char字符,在强转为int时显示的是它的Unicode编码,可以采用Integer.valueOf(value.charAt(0)+"")的形式

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网