In Example FromHowTo, open the OPCPacakge read-only to not try to write it back on close()

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1738097 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2016-04-07 07:25:02 +00:00
parent d494f3135c
commit 3718d45538

View File

@ -19,6 +19,7 @@ package org.apache.poi.xssf.eventusermodel.examples;
import java.io.InputStream;
import java.util.Iterator;
import org.apache.poi.openxml4j.opc.PackageAccess;
import org.apache.poi.xssf.eventusermodel.XLSX2CSV;
import org.apache.poi.xssf.eventusermodel.XSSFReader;
import org.apache.poi.xssf.model.SharedStringsTable;
@ -39,7 +40,7 @@ import org.xml.sax.helpers.XMLReaderFactory;
*/
public class FromHowTo {
public void processFirstSheet(String filename) throws Exception {
OPCPackage pkg = OPCPackage.open(filename);
OPCPackage pkg = OPCPackage.open(filename, PackageAccess.READ);
try {
XSSFReader r = new XSSFReader(pkg);
SharedStringsTable sst = r.getSharedStringsTable();
@ -59,7 +60,7 @@ public class FromHowTo {
}
public void processAllSheets(String filename) throws Exception {
OPCPackage pkg = OPCPackage.open(filename);
OPCPackage pkg = OPCPackage.open(filename, PackageAccess.READ);
try {
XSSFReader r = new XSSFReader(pkg);
SharedStringsTable sst = r.getSharedStringsTable();