diff --git a/core/src/main/java/org/opencdmp/filetransformer/docx/service/wordfiletransformer/word/WordBuilderImpl.java b/core/src/main/java/org/opencdmp/filetransformer/docx/service/wordfiletransformer/word/WordBuilderImpl.java index e26419d..f8b3d92 100644 --- a/core/src/main/java/org/opencdmp/filetransformer/docx/service/wordfiletransformer/word/WordBuilderImpl.java +++ b/core/src/main/java/org/opencdmp/filetransformer/docx/service/wordfiletransformer/word/WordBuilderImpl.java @@ -285,15 +285,19 @@ public class WordBuilderImpl implements WordBuilder { } private void createPages(List datasetProfilePages, PropertyDefinitionModel propertyDefinitionModel, XWPFDocument mainDocumentPart, VisibilityService visibilityService) { - datasetProfilePages.stream().filter(item -> item.getSections() != null).forEach(item -> { - try { - if (visibilityService.isVisible(item.getId(), null)) { - createSections(item.getSections(), propertyDefinitionModel, mainDocumentPart, 0, false, item.getOrdinal() + 1, null, visibilityService); + for (PageModel item : datasetProfilePages) { + if (item.getSections() != null) { + try { + XWPFParagraph paragraph = addParagraphContent(item.getOrdinal() + 1 + " " + item.getTitle(), mainDocumentPart, ParagraphStyle.HEADER5, numId, 0); + mainDocumentPart.getPosOfParagraph(paragraph); + if (visibilityService.isVisible(item.getId(), null)) { + createSections(item.getSections(), propertyDefinitionModel, mainDocumentPart, 1, false, item.getOrdinal() + 1, null, visibilityService); + } + } catch (Exception e) { + logger.error(e.getMessage(), e); + } } - } catch (Exception e) { - logger.error(e.getMessage(), e); } - }); } private boolean createSections(List sections, PropertyDefinitionModel propertyDefinitionModel, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, Integer page, String sectionString, VisibilityService visibilityService) {