All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gutenberg.itext.pegdown.TableInfos Maven / Gradle / Ivy

There is a newer version: 1.3.0
Show newest version
package gutenberg.itext.pegdown;

import com.itextpdf.text.Element;
import com.itextpdf.text.pdf.PdfPTable;
import org.pegdown.ast.TableColumnNode;

import java.util.List;

/**
 * @author @aloyer
 */
public class TableInfos {
    private final PdfPTable table;
    private final List tableNodeColumns;

    public TableInfos(PdfPTable table, List tableNodeColumns) {
        this.table = table;
        this.tableNodeColumns = tableNodeColumns;
    }

    public PdfPTable getTable() {
        return table;
    }

    public int columnAlignment(int col) {
        TableColumnNode tcn = tableNodeColumns.get(col);
        switch (tcn.getAlignment()) {
            case Left:
                return Element.ALIGN_LEFT;
            case Right:
                return Element.ALIGN_RIGHT;
            case None:
                return Element.ALIGN_UNDEFINED;
            case Center:
            default:
                return Element.ALIGN_CENTER;
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy