Source:
private void fillReleaseDetailList(XWPFDocument document, Collection<LicenseInfoParsingResult> projectLicenseInfoResults) { XWPFRun releaseInfoTextRun = document.createParagraph().createRun(); setText(releaseInfoTextRun, "Please note the following license conditions and copyright " + "notices applicable to Open Source Software and/or other components (or parts thereof):"); addNewLines(document.createParagraph().createRun(), 0); for (LicenseInfoParsingResult parsingResult : projectLicenseInfoResults) { addReleaseTitle(document, parsingResult); if (parsingResult.getStatus() == LicenseInfoRequestStatus.SUCCESS) { XWPFRun copyrightTitleRun = document.createParagraph().createRun(); addFormattedText(copyrightTitleRun, "Copyrights", FONT_SIZE, true); for (String copyright : getReleaseCopyrights(parsingResult)) { XWPFParagraph copyPara = document.createParagraph(); copyPara.setSpacingAfter(0); setText(copyPara.createRun(), copyright); } XWPFRun licensesTitleRun = document.createParagraph().createRun(); addNewLines(licensesTitleRun, 1); addFormattedText(licensesTitleRun, "Licenses", FONT_SIZE, true); for (String licenseName : getReleasesLicenses(parsingResult)) { XWPFParagraph licensePara = document.createParagraph(); licensePara.setSpacingAfter(0); addHyperLink(licensePara, "bookmark_" + licenseName, licenseName); } } else { XWPFRun errorRun = document.createParagraph().createRun(); String errorText = nullToEmptyString(parsingResult.getMessage()); String filename = getFilename(parsingResult); addFormattedText(errorRun, String.format("Error reading license information: %s", errorText), FONT_SIZE, false, ALERT_COLOR); addFormattedText(errorRun, String.format("Source file: %s", filename), FONT_SIZE, false, ALERT_COLOR); } addNewLines(document.createParagraph().createRun(), 1); } addPageBreak(document.createParagraph().createRun()); }

Target:
private void fillReleaseDetailList(XWPFDocument document, Collection<LicenseInfoParsingResult> projectLicenseInfoResults) { XWPFRun releaseTitleTextRun = document.createParagraph().createRun(); addFormattedText(releaseTitleTextRun, "Detailed Releases Information", FONT_SIZE + 2, true); XWPFRun releaseInfoTextRun = document.createParagraph().createRun(); setText(releaseInfoTextRun, "Please note the following license conditions and copyright " + "notices applicable to Open Source Software and/or other components (or parts thereof):"); addNewLines(document, 0); for (LicenseInfoParsingResult parsingResult : projectLicenseInfoResults) { addReleaseTitle(document, parsingResult); if (parsingResult.getStatus() == LicenseInfoRequestStatus.SUCCESS) { XWPFRun copyrightTitleRun = document.createParagraph().createRun(); addFormattedText(copyrightTitleRun, "Copyrights", FONT_SIZE, true); for (String copyright : getReleaseCopyrights(parsingResult)) { XWPFParagraph copyPara = document.createParagraph(); copyPara.setSpacingAfter(0); setText(copyPara.createRun(), copyright); } XWPFRun licensesTitleRun = document.createParagraph().createRun(); addNewLines(licensesTitleRun, 1); addFormattedText(licensesTitleRun, "Licenses", FONT_SIZE, true); for (String licenseName : getReleasesLicenses(parsingResult)) { XWPFParagraph licensePara = document.createParagraph(); licensePara.setSpacingAfter(0); addBookmarkHyperLink(licensePara, licenseName, licenseName); } } else { XWPFRun errorRun = document.createParagraph().createRun(); String errorText = nullToEmptyString(parsingResult.getMessage()); String filename = getFilename(parsingResult); addFormattedText(errorRun, String.format("Error reading license information: %s", errorText), FONT_SIZE, false, ALERT_COLOR); addFormattedText(errorRun, String.format("Source file: %s", filename), FONT_SIZE, false, ALERT_COLOR); } addNewLines(document, 1); } addPageBreak(document); }