Class DataTable

java.lang.Object
be.quodlibet.boxable.datatable.DataTable

public class DataTable extends Object
Write CSV documents directly to PDF Tables
Author:
Dries Horions <dries@quodlibet.be>
  • Field Details

    • HASHEADER

      public static final Boolean HASHEADER
    • NOHEADER

      public static final Boolean NOHEADER
  • Constructor Details

    • DataTable

      public DataTable(Table table, org.apache.pdfbox.pdmodel.PDPage page) throws IOException

      Create a CSVTable object to be able to add CSV document to a Table. A page needs to be passed to the constructor so the Template Cells can be created.

      Parameters:
      table - Table
      page - PDPage
      Throws:
      IOException - If there is an error releasing resources
    • DataTable

      public DataTable(Table table, org.apache.pdfbox.pdmodel.PDPage page, UpdateCellProperty updateCellProperty) throws IOException

      Create a CSVTable object to be able to add CSV document to a Table. A page needs to be passed to the constructor so the Template Cells can be created.The interface allows you to update the cell property

      Parameters:
      table - Table
      page - PDPage
      updateCellProperty - UpdateCellProperty
      Throws:
      IOException - If there is an error releasing resources
    • DataTable

      public DataTable(Table table, org.apache.pdfbox.pdmodel.PDPage page, List<Float> colWidths) throws IOException

      Create a CSVTable object to be able to add CSV document to a Table. A page needs to be passed to the constructor so the Template Cells can be created. The column widths can be given

      Parameters:
      table - Table
      page - PDPage
      colWidths - column widths
      Throws:
      IOException - If there is an error releasing resources
    • DataTable

      public DataTable(Table table, org.apache.pdfbox.pdmodel.PDPage page, List<Float> colWidths, UpdateCellProperty updateCellProperty) throws IOException

      Create a CSVTable object to be able to add CSV document to a Table. A page needs to be passed to the constructor so the Template Cells can be created. The column widths can be given and an interface allows you to update the cell property

      Parameters:
      table - Table
      page - PDPage
      colWidths - column widths
      updateCellProperty - UpdateCellProperty
      Throws:
      IOException - If there is an error releasing resources
  • Method Details

    • getTable

      public Table getTable()

      Get the table to add the csv content to

      Returns:
      Table
    • setTable

      public void setTable(Table table)

      Set the Table that the CSV document will be added to

      Parameters:
      table - Table
    • getColWidths

      public List<Float> getColWidths()

      return the column widths if provided otherwise null

      Returns:
      column widths
    • setColWidths

      public void setColWidths(List<Float> colWidths)

      Set the column widths

      Parameters:
      colWidths -
    • getHeaderCellTemplate

      public Cell getHeaderCellTemplate()

      Get the Cell Template that will be applied to header cells.

      Returns:
      header Cell's template
    • getDataCellTemplateEven

      @Deprecated public Cell getDataCellTemplateEven()
      Deprecated.

      Get the Cell Template that will be assigned to Data cells that are in even rows, and are not the first or last column

      Returns:
      data Cell's template
    • getDataCellTemplateOdd

      @Deprecated public Cell getDataCellTemplateOdd()
      Deprecated.

      Get the Cell Template that will be assigned to Data cells that are in odd rows, and are not the first or last column

      Returns:
      data Cell's template
    • getDataCellTemplateEvenList

      public List<Cell> getDataCellTemplateEvenList()

      Get the Cell Templates that will be assigned to Data cells that are in even rows, and it contain first and last column. By default dataCellTemplateEvenList.get(1) will be used for all data even cells

      Returns:
      data Cell's template
    • getDataCellTemplateOddList

      public List<Cell> getDataCellTemplateOddList()

      Get the Cell Templates that will be assigned to Data cells that are in odd rows, and it contain first and last column. By default dataCellTemplateOddList.get(1) will be used for all data odd cells

      Returns:
      data Cell's template
    • getFirstColumnCellTemplate

      public Cell getFirstColumnCellTemplate()

      Get the Cell Template that will be assigned to cells in the first column

      Returns:
      Cell's template
    • getLastColumnCellTemplate

      public Cell getLastColumnCellTemplate()

      Get the Cell Template that will be assigned to cells in the last columns

      Returns:
      Cell's template
    • getFirstColumnCellTemplateOdd

      public Cell getFirstColumnCellTemplateOdd()

      Get the Cell Template that will be assigned to cells in the first column that are in odd rows

      Returns:
      Cell's template
    • getLastColumnCellTemplateOdd

      public Cell getLastColumnCellTemplateOdd()

      Get the Cell Template that will be assigned to cells in the last columns that are in odd rows

      Returns:
      Cell's template
    • getFirstColumnCellTemplateEven

      public Cell getFirstColumnCellTemplateEven()

      Get the Cell Template that will be assigned to cells in the first column that are in even rows

      Returns:
      Cell's template
    • getLastColumnCellTemplateEven

      public Cell getLastColumnCellTemplateEven()

      Get the Cell Template that will be assigned to cells in the last columns that are in even rows

      Returns:
      Cell's template
    • addListToTable

      public void addListToTable(List<List> data, Boolean hasHeader) throws IOException

      Add a List of Lists to the Table

      Parameters:
      data - Table's data
      hasHeader - boolean if Table has header
      Throws:
      IOException - parsing error
    • addCsvToTable

      public void addCsvToTable(String data, Boolean hasHeader, char separator) throws IOException

      Add a String representing a CSV document to the Table

      Parameters:
      data - Table's data
      hasHeader - boolean if Table has header
      separator - char on which data will be parsed
      Throws:
      IOException - parsing error