Access table cell border style as line properties

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1875748 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alain Béarez 2020-03-27 03:13:43 +00:00
parent a639808c2c
commit 456dc4d368
2 changed files with 15 additions and 3 deletions

View File

@ -90,11 +90,10 @@ public class XSLFTable extends XSLFGraphicFrame implements Iterable<XSLFTableRow
@Override @Override
public XSLFTableCell getCell(int row, int col) { 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; return null;
} }
XSLFTableRow r = rows.get(row); XSLFTableRow r = _rows.get(row);
if (r == null) { if (r == null) {
// empty row // empty row
return null; return null;

View 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.TableCell;
import org.apache.poi.sl.usermodel.VerticalAlignment; import org.apache.poi.sl.usermodel.VerticalAlignment;
import org.apache.poi.util.Units; 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.xddf.usermodel.text.XDDFTextBody;
import org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties; import org.apache.poi.xslf.usermodel.XSLFPropertiesDelegate.XSLFFillProperties;
import org.apache.poi.xslf.usermodel.XSLFTableStyle.TablePartStyle; 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 @Override
public void removeBorder(BorderEdge edge) { public void removeBorder(BorderEdge edge) {
CTTableCellProperties pr = getCellProperties(false); CTTableCellProperties pr = getCellProperties(false);