Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

One of the excel study notes

Shulou Source: shulou.com Published: 2022-06-03 07:07:05 11月23日 Update

Indicates that the read supports 97 to 2003.

Import java.io.FileInputStream

Import java.io.InputStream

Import java.text.DecimalFormat

Import java.text.SimpleDateFormat

Import java.util.Date

Import org.apache.poi.hssf.usermodel.HSSFCell

Import org.apache.poi.hssf.usermodel.HSSFDataFormat

Import org.apache.poi.hssf.usermodel.HSSFDateUtil

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

Import org.apache.poi.ss.usermodel.CellStyle

/ / excle read

Public class Demo1 {

Public static void main (String [] args) throws Exception {

InputStream is = new FileInputStream ("E:\\ data.xls")

POIFSFileSystem fs = new POIFSFileSystem (is)

HSSFWorkbook wb = new HSSFWorkbook (fs); / / create a new workbook

HSSFSheet hssfSheet = wb.getSheetAt (0)

If (hssfSheet = = null)

{

Return

}

/ / traversing the line row

For (int rowNum = 0; rowNum)

Tags: Type format unit date formula character string Boolean number processing general numeric document method time result error work support note Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MariaDB Redmi Docker vpn