try to make CommentsTable more extensible

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1895180 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2021-11-19 18:01:34 +00:00
parent b4f36926dc
commit 72dbcf4702
2 changed files with 5 additions and 4 deletions

View File

@ -16,8 +16,8 @@
==================================================================== */ ==================================================================== */
package org.apache.poi.xssf.model; package org.apache.poi.xssf.model;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.util.CellAddress; import org.apache.poi.ss.util.CellAddress;
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;
@ -84,7 +84,7 @@ public interface Comments {
* @return new XSSFComment * @return new XSSFComment
* @since POI 5.2.0 * @since POI 5.2.0
*/ */
XSSFComment createNewComment(XSSFSheet sheet, XSSFClientAnchor clientAnchor); XSSFComment createNewComment(XSSFSheet sheet, ClientAnchor clientAnchor);
/** /**
* Called after the reference is updated, so that * Called after the reference is updated, so that

View File

@ -27,6 +27,7 @@ import java.util.Map;
import org.apache.poi.ooxml.POIXMLDocumentPart; import org.apache.poi.ooxml.POIXMLDocumentPart;
import org.apache.poi.openxml4j.opc.PackagePart; import org.apache.poi.openxml4j.opc.PackagePart;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.util.CellAddress; 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;
@ -256,10 +257,10 @@ public class CommentsTable extends POIXMLDocumentPart implements Comments {
* @since POI 5.2.0 * @since POI 5.2.0
*/ */
@Override @Override
public XSSFComment createNewComment(XSSFSheet sheet, XSSFClientAnchor clientAnchor) { public XSSFComment createNewComment(XSSFSheet sheet, ClientAnchor clientAnchor) {
XSSFVMLDrawing vml = sheet.getVMLDrawing(true); XSSFVMLDrawing vml = sheet.getVMLDrawing(true);
com.microsoft.schemas.vml.CTShape vmlShape = vml.newCommentShape(); com.microsoft.schemas.vml.CTShape vmlShape = vml.newCommentShape();
if (clientAnchor.isSet()) { if (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
// DrawingML-anchor // DrawingML-anchor
// but create a VML Drawing // but create a VML Drawing