Bug 62431

Summary: Regarding the removal of Border from the XSLFTableCell incase of Merge
Product: POI Reporter: sakshijuyal12690
Component: XSLFAssignee: POI Developers List <dev>
Status: NEEDINFO ---    
Severity: blocker    
Priority: P2    
Version: 3.14-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description sakshijuyal12690 2018-06-06 11:55:54 UTC
When I am trying to merge 2 XSLFTableCell cells horizontally or Vertically using the XSLFTable.mergeCells() function the border that is applied on the original cell does not get added to the merged Cell and when I try to do the same manually by getting the specific merged Cell from the table and apply border manually, it does not allow me to do the same.

This is a major blocker for the application I am working on and I am unable to find anything on this. I request you to look into this and revert back with the solution as soon as possible.
Comment 1 PJ Fanning 2018-06-06 14:04:38 UTC
Could you try the latest version (3.17) and the dev version (by compiling the latest source - https://poi.apache.org/subversion.html)?

https://www.docx4java.org/trac/docx4j may also be an option.
Comment 2 Mark Murphy 2018-06-06 14:53:03 UTC
I do this all the time, can you post some code that fails?
Comment 3 Dominik Stadler 2018-06-07 07:26:59 UTC
Please keep in mind that this is an all-volunteer driven open source project, nobody is paid to work on it. All support/work is done in peoples free and unpaid time. 

Therefore "requesting to look into it" and "as soon as possible" is highly inappropriate.
Comment 4 Andreas Beeker 2018-06-17 20:09:21 UTC
(In reply to sakshijuyal12690 from comment #0)
> ... and when I try to do the
> same manually by getting the specific merged Cell from the table and apply
> border manually, it does not allow me to do the same.

Works for me - tested with Libre Office. the table_test.pptx is located at [1]. You need to attach your slideshow and the manual version of your code.

try (XMLSlideShow ppt = XSLFTestDataSamples.openSampleDocument("table_test.pptx")) {
    XSLFTable tab = (XSLFTable)ppt.getSlides().get(0).getShapes().get(0);
    tab.mergeCells(0, 1, 1, 1);
    XSLFTableCell cell = tab.getCell(0, 1);
    cell.setBorderColor(BorderEdge.bottom, Color.red);
    try (FileOutputStream fos = new FileOutputStream("merge.pptx")) {
        ppt.write(fos);
    }
}

[1] https://svn.apache.org/repos/asf/poi/trunk/test-data/slideshow/table_test.pptx
Comment 5 sakshijuyal12690 2018-07-03 09:33:19 UTC
int colspan = Integer.parseInt(cellStyle.getColSpan());
				int finalcolSpan = colspan;
				boolean isMergeRequired = false;
				while(finalcolSpan > 1) {
					
XSLFTableCell cell1 = contentRow.addCell();
setCellHeight(cellStyle, contentRow, pageHeight);
					
isMergeRequired = true;
finalcolSpan--;
			
if (isMergeRequired) {
   tb1.mergeCells(rowNum, rowNum, colIndex, colIndex+colspan-1);
	}

// failing at this line

XSLTableCell cell = tb1.getCell(1,2);
cell.setBorderColor(BorderEdge.bottom, Color.RED);

When I am trying to manually get the Cell from the table and apply Border Color to the Cell and when I am trying to open the ppt, I am getting a pop up that power point detected a problem an is attempting to repair it and when I finally open the ppt, I cannot see the changes.
Comment 6 sakshijuyal12690 2018-07-03 09:34:18 UTC
I am using version 3.14 of apache POI