Apache POI 4.x here. I see there are two types of Workbook
implementations:
I need to write a Java 8 app that reads Excel sheets with either " .xls
" (XLS) or " .xlsx
" (XLSX) extensions. Meaning, Excel files that were saved in the "old" (pre 2003) format, or the newer one.
Is it safe to assume I use HSSF for XLS files, and XSSF for XLSX files? Or is the mapping logic a little bit more complicated there? This answer seems to indicate I'm correct, but that doesn't leave me feeling totally sure that I understand the mapping and "when to use" logic of HSSF vs XSSF.
I've scoured the POI documentation but can't find a clear answer for the life of me.
HSSF ( org.apache.poi.hssf.usermodel
package) is for XLS files format
XSSF ( org.apache.poi.xssf.usermodel
package) is for XLSX files format (newer one)
Model classes from both packages (xssf and hssf) implements common interfaces from org.apache.poi.ss.usermodel
package. So, you potentially can write a code using ss
package and it will work with abstractions over xssf or hssf.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.