]> source.dussan.org Git - poi.git/commitdiff
Access table cell border style as line properties
authorAlain Béarez <abearez@apache.org>
Fri, 27 Mar 2020 03:13:43 +0000 (03:13 +0000)
committerAlain Béarez <abearez@apache.org>
Fri, 27 Mar 2020 03:13:43 +0000 (03:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1875748 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTable.java
src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java

index a28d339fce06f52941212d8240779373390ce7e4..5f64a56260293f45cad4ceeb0c3432f214f46710 100644 (file)
@@ -90,11 +90,10 @@ public class XSLFTable extends XSLFGraphicFrame implements Iterable<XSLFTableRow
 
     @Override
     public XSLFTableCell getCell(int row, int col) {
-        List<XSLFTableRow> rows = getRows();
-        if (row < 0 || rows.size() <= row) {
+        if (row < 0 || _rows.size() <= row) {
             return null;
         }
-        XSLFTableRow r = rows.get(row);
+        XSLFTableRow r = _rows.get(row);
         if (r == null) {
             // empty row
             return null;
index 76f5a0d92b3109238f411bea469d22d77ad366c7..d30bfa552112395948e1a9be0654766f4b368179 100644 (file)
@@ -33,6 +33,7 @@ import org.apache.poi.sl.usermodel.StrokeStyle.LineDash;
 import org.apache.poi.sl.usermodel.TableCell;
 import org.apache.poi.sl.usermodel.VerticalAlignment;
 import org.apache.poi.util.Units;
+import org.apache.poi.xddf.usermodel.XDDFLineProperties;
 import org.apache.poi.xddf.usermodel.text.XDDFTextBody;
 import org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties;
 import org.apache.poi.xslf.usermodel.XSLFTableStyle.TablePartStyle;
@@ -139,6 +140,18 @@ public class XSLFTableCell extends XSLFTextShape implements TableCell<XSLFShape,
         }
     }
 
+    public XDDFLineProperties getBorderProperties(BorderEdge edge) {
+        CTLineProperties props = getCTLine(edge, false);
+        return (props == null) ? null : new XDDFLineProperties(props);
+    }
+
+    public void setBorderProperties(BorderEdge edge, XDDFLineProperties properties) {
+        CTLineProperties props = getCTLine(edge, true);
+        if (props != null) {
+            props.set(properties.getXmlObject().copy());
+        }
+    }
+
     @Override
     public void removeBorder(BorderEdge edge) {
         CTTableCellProperties pr = getCellProperties(false);