From faad31ef79451844cfdd80a1502ab1a67eb65333 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Thu, 7 Apr 2016 07:25:02 +0000 Subject: [PATCH] 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 --- .../apache/poi/xssf/eventusermodel/examples/FromHowTo.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java b/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java index 88c5f68ca5..87c6c2ca5e 100644 --- a/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java +++ b/src/examples/src/org/apache/poi/xssf/eventusermodel/examples/FromHowTo.java @@ -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(); -- 2.39.5