use non deprecated method for adding string to shared strings table

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1818623 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2017-12-18 20:54:39 +00:00
parent 1ccc7bfd46
commit af11cb1023
2 changed files with 5 additions and 5 deletions

View File

@ -193,7 +193,7 @@ public class SharedStringsTable extends POIXMLDocumentPart {
* @return index the index of added entry
* @deprecated use <code>addSharedStringItem(RichTextString string)</code> instead
*/
@Removal(version = "4.2")
@Removal(version = "4.2") //make private in 4.2
public int addEntry(CTRst st) {
String s = getKey(st);
count++;
@ -278,8 +278,8 @@ public class SharedStringsTable extends POIXMLDocumentPart {
@Override
protected void commit() throws IOException {
PackagePart part = getPackagePart();
OutputStream out = part.getOutputStream();
writeTo(out);
out.close();
try (OutputStream out = part.getOutputStream()) {
writeTo(out);
}
}
}

View File

@ -280,7 +280,7 @@ public class SheetDataWriter implements Closeable {
case STRING: {
if (_sharedStringSource != null) {
XSSFRichTextString rt = new XSSFRichTextString(cell.getStringCellValue());
int sRef = _sharedStringSource.addEntry(rt.getCTRst());
int sRef = _sharedStringSource.addSharedStringItem(rt);
writeAttribute("t", STCellType.S.toString());
_out.write("><v>");