pro.verron.officestamper.core.SectionUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of engine Show documentation
Show all versions of engine Show documentation
Office-stamper is a Java template engine for docx documents, forked from org.wickedsource.docx-stamper
package pro.verron.officestamper.core;
import org.docx4j.XmlUtils;
import org.docx4j.jaxb.Context;
import org.docx4j.wml.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.lang.Nullable;
import pro.verron.officestamper.api.OfficeStamperException;
import java.util.List;
import static java.util.Optional.ofNullable;
/**
* Utility class to handle section breaks in paragraphs.
*
* @author Joseph Verron
* @version ${version}
* @since 1.6.2
*/
public class SectionUtil {
private static final Logger log = LoggerFactory.getLogger(SectionUtil.class);
private SectionUtil() {
throw new OfficeStamperException("Utility class shouldn't be instantiated");
}
private static final ObjectFactory factory = Context.getWmlObjectFactory();
/**
* Creates a new section break object.
*
* @param firstObject a {@link Object} object
* @param parent a {@link ContentAccessor} object
* @return a new section break object.
*/
@Nullable
public static SectPr getPreviousSectionBreakIfPresent(Object firstObject, ContentAccessor parent) {
List