Bug 63558

Summary: XSLFTextParagraph leaves first line blank in cell in XSLFTableCell
Product: POI Reporter: Trupti <truptikokamkar08>
Component: XSLFAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Linux   

Description Trupti 2019-07-10 04:30:58 UTC
When XSLFTextParagraph is added to XSLFTableCell and when new TextRun is added to the paragraph, text in the cell starts from second line in the cell. We can see that when PPT is opened. this issue is not letting us utilize vertical space and accommodate more rows.
Comment 1 Andreas Beeker 2019-07-22 22:07:49 UTC
Please add an example - I can't reproduce your issue on the trunk. Tested with Libre Office.



> @Test
> public void bug63558() throws Exception {
>     XMLSlideShow ppt = new XMLSlideShow();
>     XSLFSlide slide = ppt.createSlide();
>     XSLFTable tab = slide.createTable(4,3);
>     tab.setAnchor(new Rectangle2D.Double(50,50,500,500));
>     for (int x=0; x<4; x++) {
>         for (int y=0; y<3; y++) {
>             XSLFTableCell cell = tab.getCell(x, y);
>             // Variant 1
>             // cell.setText("("+x+","+y+")");
>             // Variant 2
>             cell.addNewTextParagraph().addNewTextRun().setText("("+x+","+y+")");
>         }
>     }
>     new DrawTableShape(tab).setAllBorders(2., Color.BLACK, StrokeStyle.LineDash.LG_DASH);
>     try (FileOutputStream fos = new FileOutputStream("blub.pptx")) {
>         ppt.write(fos);
>     }
> }
Comment 2 Dominik Stadler 2019-11-17 12:38:03 UTC
No response in quite some time, so we close this for now, please provide more information if this is still a problem for you.