remove XDDFChart workaround that saved workbook to temp file

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1825541 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2018-02-28 09:54:58 +00:00
parent 590f27e86d
commit dcbe14abd0

View File

@ -21,8 +21,6 @@ package org.apache.poi.xddf.usermodel.chart;
import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS; import static org.apache.poi.POIXMLTypeLoader.DEFAULT_XML_OPTIONS;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
@ -43,12 +41,10 @@ import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException; import org.apache.poi.openxml4j.exceptions.NotOfficeXmlFileException;
import org.apache.poi.openxml4j.opc.PackagePart; import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.openxml4j.opc.PackageRelationship; import org.apache.poi.openxml4j.opc.PackageRelationship;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.ss.util.CellReference; import org.apache.poi.ss.util.CellReference;
import org.apache.poi.util.Beta; import org.apache.poi.util.Beta;
import org.apache.poi.util.Internal; import org.apache.poi.util.Internal;
import org.apache.poi.util.TempFile;
import org.apache.poi.xddf.usermodel.XDDFShapeProperties; import org.apache.poi.xddf.usermodel.XDDFShapeProperties;
import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFRow;
@ -693,19 +689,7 @@ public abstract class XDDFChart extends POIXMLDocumentPart {
* @since POI 4.0.0 * @since POI 4.0.0
*/ */
public void setWorkbook(XSSFWorkbook workbook) { public void setWorkbook(XSSFWorkbook workbook) {
File file; this.workbook = workbook;
FileOutputStream fos;
try {
file = TempFile.createTempFile("TempEmbedded",".xlsx");
fos = new FileOutputStream(file);
workbook.write(fos);
fos.close();
this.workbook = new XSSFWorkbook(file);
} catch (IOException e) {
} catch (InvalidFormatException e) {
}
} }
/** /**