
excel
public class excelLineTest { public static void mAIn(String[] args) { try { // 创建一个工作簿对象 XSSFWorkbook workbook = new XSSFWorkbook(); // 创建一个工作表对象 XSSFSheet sheet = workbook.createSheet("Sheet1"); // 创建一个单元格对象 Cell cell = sheet.createCell(0, 0); // 设置单元格字体样式 XSSFCellStyle style = (XSSFCellStyle) workbook.createCellStyle(); Font font = workbook.getFontAt(0); style.setDataFormat(XSSFDataFormat.Font.getInstance(font)); cell.setcellStyle(style); // 设置单元格内容 cell.setcellValue("Hello, world!"); // 创建行数和列数 int rows = 10; int cols = 10; for (int i = 1; i
Copyright © 2025 IZhiDa.com All Rights Reserved.
知答 版权所有 粤ICP备2023042255号