Add page titles

This commit is contained in:
Efstratios Giannopoulos 2024-06-11 11:45:32 +03:00
parent 8ea888f130
commit 8fc3fcd561
1 changed files with 11 additions and 7 deletions

View File

@ -285,15 +285,19 @@ public class WordBuilderImpl implements WordBuilder {
} }
private void createPages(List<PageModel> datasetProfilePages, PropertyDefinitionModel propertyDefinitionModel, XWPFDocument mainDocumentPart, VisibilityService visibilityService) { private void createPages(List<PageModel> datasetProfilePages, PropertyDefinitionModel propertyDefinitionModel, XWPFDocument mainDocumentPart, VisibilityService visibilityService) {
datasetProfilePages.stream().filter(item -> item.getSections() != null).forEach(item -> { for (PageModel item : datasetProfilePages) {
if (item.getSections() != null) {
try { try {
XWPFParagraph paragraph = addParagraphContent(item.getOrdinal() + 1 + " " + item.getTitle(), mainDocumentPart, ParagraphStyle.HEADER5, numId, 0);
mainDocumentPart.getPosOfParagraph(paragraph);
if (visibilityService.isVisible(item.getId(), null)) { if (visibilityService.isVisible(item.getId(), null)) {
createSections(item.getSections(), propertyDefinitionModel, mainDocumentPart, 0, false, item.getOrdinal() + 1, null, visibilityService); createSections(item.getSections(), propertyDefinitionModel, mainDocumentPart, 1, false, item.getOrdinal() + 1, null, visibilityService);
} }
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
} }
}); }
}
} }
private boolean createSections(List<SectionModel> sections, PropertyDefinitionModel propertyDefinitionModel, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, Integer page, String sectionString, VisibilityService visibilityService) { private boolean createSections(List<SectionModel> sections, PropertyDefinitionModel propertyDefinitionModel, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, Integer page, String sectionString, VisibilityService visibilityService) {