mirror of https://github.com/apache/poi.git
expose VMLDrawing in SXSSF code
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895189 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b2a7a1729f
commit
e9355ddad4
|
@ -34,6 +34,7 @@ import org.apache.poi.ss.util.CellAddress;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.Removal;
|
import org.apache.poi.util.Removal;
|
||||||
import org.apache.poi.util.Units;
|
import org.apache.poi.util.Units;
|
||||||
|
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
|
import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFComment;
|
import org.apache.poi.xssf.usermodel.XSSFComment;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||||
|
@ -220,7 +221,7 @@ public class CommentsTable extends POIXMLDocumentPart implements Comments {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSSFVMLDrawing vml = sheet instanceof XSSFSheet ? ((XSSFSheet)sheet).getVMLDrawing(false) : null;
|
XSSFVMLDrawing vml = getVMLDrawing(sheet, false);
|
||||||
return new XSSFComment(this, ctComment,
|
return new XSSFComment(this, ctComment,
|
||||||
vml == null ? null : vml.findCommentShape(cellAddress.getRow(), cellAddress.getColumn()));
|
vml == null ? null : vml.findCommentShape(cellAddress.getRow(), cellAddress.getColumn()));
|
||||||
}
|
}
|
||||||
|
@ -260,7 +261,7 @@ public class CommentsTable extends POIXMLDocumentPart implements Comments {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public XSSFComment createNewComment(Sheet sheet, ClientAnchor clientAnchor) {
|
public XSSFComment createNewComment(Sheet sheet, ClientAnchor clientAnchor) {
|
||||||
XSSFVMLDrawing vml = sheet instanceof XSSFSheet ? ((XSSFSheet)sheet).getVMLDrawing(true) : null;
|
XSSFVMLDrawing vml = getVMLDrawing(sheet, true);
|
||||||
CTShape vmlShape = vml == null ? null : vml.newCommentShape();
|
CTShape vmlShape = vml == null ? null : vml.newCommentShape();
|
||||||
if (vmlShape != null && clientAnchor instanceof XSSFClientAnchor && ((XSSFClientAnchor)clientAnchor).isSet()) {
|
if (vmlShape != null && clientAnchor instanceof XSSFClientAnchor && ((XSSFClientAnchor)clientAnchor).isSet()) {
|
||||||
// convert offsets from emus to pixels since we get a
|
// convert offsets from emus to pixels since we get a
|
||||||
|
@ -365,4 +366,13 @@ public class CommentsTable extends POIXMLDocumentPart implements Comments {
|
||||||
comments.getAuthors().insertAuthor(index, author);
|
comments.getAuthors().insertAuthor(index, author);
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private XSSFVMLDrawing getVMLDrawing(Sheet sheet, boolean autocreate) {
|
||||||
|
if (sheet instanceof XSSFSheet) {
|
||||||
|
return ((XSSFSheet)sheet).getVMLDrawing(autocreate);
|
||||||
|
} else if (sheet instanceof SXSSFSheet) {
|
||||||
|
return ((SXSSFSheet)sheet).getVMLDrawing(autocreate);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,12 +47,7 @@ import org.apache.poi.ss.util.PaneInformation;
|
||||||
import org.apache.poi.ss.util.SheetUtil;
|
import org.apache.poi.ss.util.SheetUtil;
|
||||||
import org.apache.poi.util.Internal;
|
import org.apache.poi.util.Internal;
|
||||||
import org.apache.poi.util.NotImplemented;
|
import org.apache.poi.util.NotImplemented;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFColor;
|
import org.apache.poi.xssf.usermodel.*;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFComment;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFDataValidation;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFDrawing;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFHyperlink;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetFormatPr;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetFormatPr;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetPr;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheetPr;
|
||||||
|
@ -349,6 +344,20 @@ public class SXSSFSheet implements Sheet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get VML drawing for this sheet (aka 'legacy' drawing). This method is for internal POI use only.
|
||||||
|
*
|
||||||
|
* @param autoCreate if true, then a new VML drawing part is created
|
||||||
|
*
|
||||||
|
* @return the VML drawing of {@code null} if the drawing was not found and autoCreate=false
|
||||||
|
* @since POI 5.2.0
|
||||||
|
*/
|
||||||
|
@Internal
|
||||||
|
public XSSFVMLDrawing getVMLDrawing(boolean autoCreate) {
|
||||||
|
XSSFSheet xssfSheet = getWorkbook().getXSSFSheet(this);
|
||||||
|
return xssfSheet == null ? null : xssfSheet.getVMLDrawing(autoCreate);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the CellStyle that applies to the given
|
* Returns the CellStyle that applies to the given
|
||||||
* (0 based) column, or null if no style has been
|
* (0 based) column, or null if no style has been
|
||||||
|
|
Loading…
Reference in New Issue