HSSF is the POI Project’s pure Java implementation of the Excel ’97(-2007) file format. XSSF is the POI Project’s pure Java implementation of the Excel 2007 OOXML (.xlsx) file format. HSSF and XSSF provides ways to read spreadsheets create, modify, read and write XLS spreadsheets.
package com.test; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class HSSFTest { public static void main(String[] args) { String xlsName = "D:/justForTest.xlsx"; FileInputStream fis; try { fis = new FileInputStream(xlsName); Workbook workbook = new XSSFWorkbook(fis); // Get the first sheet; Sheet sheet = workbook.getSheetAt(0); // for each row for(Row row : sheet) { Cell cell = row.getCell(0); // get the cell // print cell contents. System.out.println(cell.getStringCellValue()); } } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
The title tells everything.
from 0(A) to 103(CZ), one page, PDF, A4.
and the Excel Formula is:
=IF(A1>25,CHAR(INT(A1/26)+64),””)&CHAR(MOD(A1-0,26)+65)
Download Link:
Sina Weibo China: http://dl.dbank.com/s0xaqdngd8
需求: 找出两列中重复的数据, 以及差异的数据.
细节: AB两列, 找出A有B无, AB均有, A无B有数据, 分列CDE中.
A有B无: IF(COUNTIF($B:$B,A2)=0,A2,"B列中已有")
AB均有:IF(COUNTIF($B:$B,A2)>0,"AB有重复","B中无匹配")
A无B有: IF(COUNTIF($A:$A,B2)=0,B2,"A中有重复")
常用方法:
MID(text,start_num,num_chars), 如: =MID(A2,3,1), 截取A2单元格: 从第3个字符开始, 截取一个.
LEFT(text,num_chars), 如:=LEFT(A2, 2),截取A2单元格左侧链两个字符; 类似的有:
RIGHT(text,num_chars).
可与Find()等方法嵌套使用, 如:
=MID(A1,1,FIND("!",A1)-1): 找到A1单元格中第一个!的位置, 进行截取.
更多Excel文本函数可参考: http://office.microsoft.com/zh-cn/excel-help/HP010342953.aspx
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.