Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,10 @@ public void setBorderColor(BorderEdge edge, Color color) {
throw new IllegalArgumentException("Colors need to be specified.");
}

CTLineProperties ln = setBorderDefaults(edge);
final CTLineProperties ln = setBorderDefaults(edge);
if (ln.isSetSolidFill()) {
ln.unsetSolidFill();
}
CTSolidColorFillProperties fill = ln.addNewSolidFill();
XSLFColor c = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr(), getSheet());
c.setColor(color);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,25 @@ void testCreate() throws IOException {
ppt2.close();
}

@Test
void testBorderColorOverwrite() throws IOException {
XMLSlideShow ppt = new XMLSlideShow();
XSLFSlide slide = ppt.createSlide();
XSLFTable tbl = slide.createTable();
XSLFTableRow row = tbl.addRow();
XSLFTableCell cell = row.addCell();

for (BorderEdge edge : BorderEdge.values()) {
cell.setBorderColor(edge, Color.yellow);
assertEquals(Color.yellow, cell.getBorderColor(edge));
// additional calls to setBorderColor do not add multiple solidFill elements
cell.setBorderColor(edge, Color.red);
assertEquals(Color.red, cell.getBorderColor(edge));
}

ppt.close();
}

@Test
void removeTable() throws IOException {
XMLSlideShow ss = XSLFTestDataSamples.openSampleDocument("shapes.pptx");
Expand Down