public XSSFWorkbook(OPCPackage pkg) throws java.io.IOException Constructs a XSSFWorkbook object given a OpenXML4J Package object, see http://poi.apache.org/oxml4j/. Once you have finished working with the Workbook, you should close the package by calling pkg.close, to avoid leaving file handles open. Creating a XSSFWorkbook from a file-backed OPC Package has a lower memory footprint than an InputStream backed one. Parameters: pkg - the OpenXML4J OPC Package object. Throws: java.io.IOException XSSFWorkbook
public XSSFWorkbook(java.io.InputStream is) throws java.io.IOException Constructs a XSSFWorkbook object, by buffering the whole stream into memory and then opening an OPCPackage object for it. Using an InputStream requires more memory than using a File, so if a File is available then you should instead do something like
OPCPackage pkg = OPCPackage.open(path); XSSFWorkbook wb = new XSSFWorkbook(pkg); // work with the wb object ...... pkg.close(); // gracefully closes the underlying zip file
Debería funcionar con uno de estos dos:
XSSFWorkbook
public XSSFWorkbook(OPCPackage pkg)
throws java.io.IOException
Constructs a XSSFWorkbook object given a OpenXML4J Package object, see http://poi.apache.org/oxml4j/. Once you have finished working with the Workbook, you should close the package by calling pkg.close, to avoid leaving file handles open. Creating a XSSFWorkbook from a file-backed OPC Package has a lower memory footprint than an InputStream backed one.
Parameters:
pkg - the OpenXML4J OPC Package object.
Throws:
java.io.IOException
XSSFWorkbook
public XSSFWorkbook(java.io.InputStream is)
throws java.io.IOException
Constructs a XSSFWorkbook object, by buffering the whole stream into memory and then opening an OPCPackage object for it. Using an InputStream requires more memory than using a File, so if a File is available then you should instead do something like
OPCPackage pkg = OPCPackage.open(path);
XSSFWorkbook wb = new XSSFWorkbook(pkg);
// work with the wb object
......
pkg.close(); // gracefully closes the underlying zip file
Throws:
java.io.IOException