嘴唇长泡怎么办
POI格式化Cell样式4.1.2版本
poi版本
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
弟子规全文拼音版
<version>4.1.2</version>
</dependency>
import java.io.FileOutputStream;
import org.apache.poi.ss.urmodel.*;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.urmodel.XSSFCellStyle;
import org.apache.poi.xssf.urmodel.XSSFColor;
import org.apache.poi.xssf.urmodel.XSSFWorkbook;
public class Test {
public static void main(String[] args){
try{
// 创建Excel表格⼯作簿
Workbook wb =new XSSFWorkbook();
Sheet sheet = wb.createSheet("表格单元格格式化");
//============================
// 设置单元格的字体
//============================
马申科Row ztRow = ateRow((short)0);
Cell ztCell = ateCell(0);
ztCell.tCellValue("Test");
// 创建单元格样式对象
XSSFCellStyle ztStyle =(XSSFCellStyle) wb.createCellStyle();
// 创建字体对象
Font ztFont = wb.createFont();画ppt
ztFont.tItalic(true);// 设置字体为斜体字
ztFont.tColor(Font.COLOR_RED);// 将字体设置为“红⾊”
ztFont.tFontHeightInPoints((short)22);// 将字体⼤⼩设置为18px
ztFont.tFontName("华⽂⾏楷");// 将“华⽂⾏楷”字体应⽤到当前单元格上
ztFont.tUnderline(Font.U_DOUBLE);// 添加(Font.U_SINGLE单条下划线/Font.U_DOUBLE双条下划线)// ztFont.tStrikeout(true); // 是否添加删除线
ztStyle.tFont(ztFont);// 将字体应⽤到样式上⾯
ztCell.tCellStyle(ztStyle);// 样式应⽤到该单元格上
//============================
// 设置单元格边框
//============================
Row borderRow = ateRow(2);
Cell borderCell = ateCell(1);
borderCell.tCellValue("Test");
// 创建单元格样式对象
XSSFCellStyle borderStyle =(ateCellStyle();
// 设置单元格边框样式
// BorderStyle.DOUBLE 双边线
// BorderStyle.THIN 细边线
// BorderStyle.MEDIUM 中等边线
// BorderStyle.MEDIUM 中等边线
// BorderStyle.DASHED 虚线边线
/
/ BorderStyle.HAIR ⼩圆点虚线边线
// BorderStyle.THICK 粗边线
borderStyle.tBorderBottom(BorderStyle.THICK);
borderStyle.tBorderTop(BorderStyle.DASHED);
borderStyle.tBorderLeft(BorderStyle.DOUBLE);
borderStyle.tBorderRight(BorderStyle.THIN);
// 设置单元格边框颜⾊
borderStyle.tBottomBorderColor(new XSSFColor(java.awt.Color.RED));
菇的拼音borderStyle.tTopBorderColor(new XSSFColor(java.awt.Color.GREEN));
borderStyle.tLeftBorderColor(new XSSFColor(java.awt.Color.BLUE));
borderCell.tCellStyle(borderStyle);
/
/============================
// 设置单元内容的对齐⽅式
//============================
Row alignRow = ateRow(4);
Cell alignCell = ateCell(1);莫言小说全集
alignCell.tCellValue("Test");
// 创建单元格样式对象
XSSFCellStyle alignStyle =(ateCellStyle();
// 设置单元格内容⽔平对其⽅式
// HorizontalAlignment.CENTER 居中对齐
// HorizontalAlignment.LEFT 左对齐
/
/ HorizontalAlignment.RIGHT 右对齐
alignStyle.tAlignment(HorizontalAlignment.CENTER);
鸳鸯怎么画// 设置单元格内容垂直对其⽅式
// VerticalAlignment.TOP 上对齐
// VerticalAlignment.CENTER 中对齐
// VerticalAlignment.BOTTOM 下对齐
alignStyle.tVerticalAlignment(VerticalAlignment.CENTER);
alignCell.tCellStyle(alignStyle);
//============================
// 设置单元格的⾼度和宽度
//============================
Row sizeRow = ateRow(6);
sizeRow.tHeightInPoints(30);// 设置⾏的⾼度
Cell sizeCell = ateCell(1);
String sizeCellValue ="《Java编程思想》";// 字符串的长度为10,表⽰该字符串中有10个字符,忽略中英⽂ sizeCell.tCellValue(sizeCellValue);
// 设置单元格的长度为sizeCellVlue的长度。⽽sheet.tColumnWidth使⽤sizeCellVlue的字节数
// Bytes().length == 16
sheet.tColumnWidth(1,(Bytes().length)*256);
//============================
// 设置单元格⾃动换⾏
//============================
Row wrapRow = ateRow(8);
Cell wrapCell = ateCell(2);
wrapCell.tCellValue("宝剑锋从磨砺出,梅花⾹⾃苦寒来");
// 创建单元格样式对象
XSSFCellStyle wrapStyle =(ateCellStyle();
wrapStyle.tWrapText(true);// 设置单元格内容是否⾃动换⾏
wrapCell.tCellStyle(wrapStyle);
//============================
//============================
// 合并单元格列
//============================炸黄豆
Row regionRow = ateRow(12);
Cell regionCell = ateCell(0);
regionCell.tCellValue("宝剑锋从磨砺出,梅花⾹⾃苦寒来");
// 合并第⼗三⾏中的A、B、C三列
CellRangeAddress region =new CellRangeAddress(12,12,0,2);// 参数都是从O开始 sheet.addMergedRegion(region);
//============================
// 合并单元格⾏和列
//============================
Row regionRow2 = ateRow(13);
Cell regionCell2 = ateCell(3);
String region2Value ="宝剑锋从磨砺出,梅花⾹⾃苦寒来。"
+"采得百花成蜜后,为谁⾟苦为谁甜。"
+"操千曲⽽后晓声,观千剑⽽后识器。"
+"察⼰则可以知⼈,察今则可以知古。";
regionCell2.tCellValue(region2Value);
// 合并第⼗三⾏中的A、B、C三列
CellRangeAddress region2 =new CellRangeAddress(13,17,3,7);// 参数都是从O开始 sheet.addMergedRegion(region2);
XSSFCellStyle region2Style =(ateCellStyle();
region2Style.tVerticalAlignment(VerticalAlignment.CENTER);
region2Style.tWrapText(true);// 设置单元格内容是否⾃动换⾏
regionCell2.tCellStyle(region2Style);
//============================
// 将Excel⽂件写⼊到磁盘上
//============================
FileOutputStream is =new FileOutputStream("D://Test.xls");
wb.write(is);
is.clo();
System.out.println("写⼊成功,运⾏结束!");
}catch(Exception e){
e.printStackTrace();
}
}
}