From bf6627ed5d3b1cbde7a3a575c69f7bf29bccd0f0 Mon Sep 17 00:00:00 2001 From: Andrei Isvoran Date: Fri, 20 Sep 2024 14:15:40 +0300 Subject: [PATCH] RED-9925 - Remove extra breakline from report --- .../report/v1/server/service/WordReportGenerationService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/WordReportGenerationService.java b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/WordReportGenerationService.java index 8e11165..601cee0 100644 --- a/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/WordReportGenerationService.java +++ b/redaction-report-service-v1/redaction-report-service-server-v1/src/main/java/com/iqser/red/service/redaction/report/v1/server/service/WordReportGenerationService.java @@ -587,7 +587,9 @@ public class WordReportGenerationService { private int setText(XWPFTableCell cell, String value) { // Apache POI automatically adds an initial empty paragraph to a cell resulting in a break line. - cell.removeParagraph(0); + if (cell.getParagraphs() != null && !cell.getParagraphs().isEmpty()) { + cell.removeParagraph(0); + } cell.setVerticalAlignment(XWPFTableCell.XWPFVertAlign.CENTER); XWPFParagraph addParagraph = cell.addParagraph(); XWPFRun run = addParagraph.createRun();