⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 excelsample5.java

📁 此源码程序实现的是eclipse开发工具中插件的开发实现参考程序
💻 JAVA
字号:
package cn.com.chengang.myplugin.poi;

import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;

public class ExcelSample5 {
	public static void main(String[] args) throws IOException {
		HSSFWorkbook wb = new HSSFWorkbook();
		HSSFSheet sheet = wb.createSheet("new sheet");
		HSSFRow row = sheet.createRow((short) 1);
		// AQUA指浅绿色背景,BIG_SPOTS是网点式底纹
		HSSFCell cell = row.createCell((short) 1);
		cell.setCellValue("X");
		HSSFCellStyle style = wb.createCellStyle();
		style.setFillBackgroundColor(HSSFColor.AQUA.index);
		style.setFillPattern(HSSFCellStyle.BIG_SPOTS);
		cell.setCellStyle(style);
		// 写入文件
		FileOutputStream fileOut = new FileOutputStream("c:\\workbook.xls");
		wb.write(fileOut);
		fileOut.close();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -