com.alphasystem.docbook.builder.impl.block.TableContentBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of docbook-2-docx Show documentation
Show all versions of docbook-2-docx Show documentation
Alpha system commons library
The newest version!
package com.alphasystem.docbook.builder.impl.block;
import com.alphasystem.docbook.builder.Builder;
import com.alphasystem.docbook.builder.impl.AbstractBuilder;
import com.alphasystem.commons.util.AppUtil;
import com.alphasystem.docx4j.builder.wml.table.VerticalMergeType;
import com.alphasystem.xml.UnmarshallerUtils;
import org.apache.commons.lang3.StringUtils;
import org.docbook.model.Entry;
import org.docbook.model.ObjectFactory;
import org.docbook.model.Row;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
public abstract class TableContentBuilder extends AbstractBuilder {
private static final ObjectFactory OBJECT_FACTORY = new ObjectFactory();
protected TableContentBuilder(S source, Builder> parent) {
super(null, source, parent);
}
/*
* Row span in DocBook works using property "morerows" in "Entry" object, which indicates how many more rows this
* column will span. For this reason, one row can have more of entries than others.
*
* In Docx has row span works using "VMerge" property. First column must have the value "restart" and subsequent columns
* must have "VMerge" property without any value. For this reason, number of columns in Docx are always same in each row.
*
* We need to scan "rows" and sanitize data to have exact number "entries" in order to row span to work correctly.
*
* More over it is possible in the DocBook number of "rows" less if each column of last row is spanning. First step
* is to find out total number of actual rows, second step to fill missing columns.
*
*/
protected List