Working with Table in Tagged PDFs

Create Table in Tagged PDF

Aspose.PDF for Java allows creating a table in Tagged PDF documents. For working with tables, the API provides TableElement class. In order to create a table, you can use createTableElement() method of ITaggedContent interface. Furthermore, you can use createTHead()createTBody() and createTFoot() methods of TableElement class for creating Table Head, Table Body, and Table Foot respectively. To create a table row, you can use createTR() method of TableRowCollectionElement class. The following code snippet shows, how to create a table in the Tagged PDF document: 

Style Table Element

Aspose.PDF for Java allows styling a table in Tagged PDF document. In order to style a table, you can create a table using createTableElement() method of ITaggedContent interface.  and set style table using properties of TableElement class. The following is the list properties you can use to style a table:

  • BackgroundColor
  • Border
  • Alignment
  • CornerStyle
  • Broken
  • ColumnAdjustment
  • ColumnWidths
  • DefaultCellBorder
  • DefaultCellPadding
  • DefaultCellTextState
  • DefaultColumnWidth
  • IsBroken
  • IsBordersIncluded
  • Left
  • Top

The following code snippet shows how to style a table in Tagged PDF document:

Style Table Row

Aspose.PDF for Java allows styling a table row in Tagged PDF document. In order to style a table row, you can use the properties of TableTRElement class. The following is the list properties you can use to style a table row:

  • BackgroundColor
  • Border
  • DefaultCellBorder
  • MinRowHeight
  • FixedRowHeight
  • IsInNewPage
  • IsRowBroken
  • DefaultCellTextState
  • DefaultCellPadding
  • VerticalAlignment

The following code snippet shows how to style a table row in the Tagged PDF document:

Style Table Cell

Aspose.PDF for Java allows styling a table cell in Tagged PDF document. In order to style a table cell, you can use the properties of TableCellElement class. The following is the list properties you can use to style a table cell:

  • BackgroundColor
  • Border
  • IsNoBorder
  • Margin
  • Alignment
  • DefaultCellTextState
  • IsWordWrapped
  • VerticalAlignment
  • ColSpan
  • RowSpan

The following code snippet shows how to style a table cell in the Tagged PDF document. You can also verify PDF/UA compliance of the created document. Code snippet below show how to use this functionality.