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

📄 excelsample11.java

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

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

import org.apache.poi.hssf.usermodel.HSSFCell;
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.poifs.filesystem.POIFSFileSystem;

public class ExcelSample11 {
	public static void main(String[] args) throws IOException {
		FileInputStream fileIn = new FileInputStream("c:\\workbook.xls");
		POIFSFileSystem fs = new POIFSFileSystem(fileIn);
		HSSFWorkbook wb = new HSSFWorkbook(fs);
		HSSFSheet sheet = wb.getSheetAt(0);
		HSSFRow row = sheet.getRow(1);
		if (row == null)
			return;
		HSSFCell cell = row.getCell((short) 1);
		if (cell == null)
			return;
		cell.setCellValue("Giles");
		// 写文件
		FileOutputStream fileOut = new FileOutputStream("c:\\workbook.xls");
		wb.write(fileOut);
		fileOut.close();
	}
}

⌨️ 快捷键说明

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