DocumentTable

Inheritance: java.lang.Object

public class DocumentTable

Provides access to data of a single table (or spreadsheet) located in an external document to be used while assembling a document.

For documents of Spreadsheet file formats, a DocumentTable instance represents a single sheet. For documents of other file formats, a DocumentTable instance represents a single table.

To access data of the corresponding table while assembling a document, pass an instance of this class as a data source to one of DocumentAssembler. assembleDocument overloads.

In template documents, a DocumentTable instance should be treated in the same way as if it was a DataTable instance. See template syntax reference for more information.

Constructors

Constructor Description
DocumentTable(String documentPath, int indexInDocument) Creates a new instance of this class using default DocumentTableOptions.
DocumentTable(String documentPath, int indexInDocument, DocumentTableOptions options) Creates a new instance of this class.
DocumentTable(InputStream documentStream, int indexInDocument) Creates a new instance of this class using default DocumentTableOptions.
DocumentTable(InputStream documentStream, int indexInDocument, DocumentTableOptions options) Creates a new instance of this class.

Methods

Method Description
getName() Gets the name of this table used to access the table’s data in a template document passed to DocumentAssembler.
setName(String value) Sets the name of this table used to access the table’s data in a template document passed to DocumentAssembler.
getIndexInDocument() Gets the original zero-based index of the corresponding table as per the source document.
getColumns() Gets the collection of DocumentTableColumn objects representing columns of the corresponding table.

DocumentTable(String documentPath, int indexInDocument)

public DocumentTable(String documentPath, int indexInDocument)

Creates a new instance of this class using default DocumentTableOptions.

Parameters:

Parameter Type Description
documentPath java.lang.String The path to a document containing the table to be accessed.
indexInDocument int The zero-based index of the table in the document.

DocumentTable(String documentPath, int indexInDocument, DocumentTableOptions options)

public DocumentTable(String documentPath, int indexInDocument, DocumentTableOptions options)

Creates a new instance of this class.

Parameters:

Parameter Type Description
documentPath java.lang.String The path to a document containing the table to be accessed.
indexInDocument int The zero-based index of the table in the document.
options DocumentTableOptions A set of options controlling extraction of data from the table. If null, default options are applied.

DocumentTable(InputStream documentStream, int indexInDocument)

public DocumentTable(InputStream documentStream, int indexInDocument)

Creates a new instance of this class using default DocumentTableOptions.

Parameters:

Parameter Type Description
documentStream java.io.InputStream The stream containing a document with the table to be accessed.
indexInDocument int The zero-based index of the table in the document.

DocumentTable(InputStream documentStream, int indexInDocument, DocumentTableOptions options)

public DocumentTable(InputStream documentStream, int indexInDocument, DocumentTableOptions options)

Creates a new instance of this class.

Parameters:

Parameter Type Description
documentStream java.io.InputStream The stream containing a document with the table to be accessed.
indexInDocument int The zero-based index of the table in the document.
options DocumentTableOptions A set of options controlling extraction of data from the table. If null, default options are applied.

getName()

public String getName()

Gets the name of this table used to access the table’s data in a template document passed to DocumentAssembler.

If the table’s name is read from a document, the name is automatically corrected so that it to be valid. However, if the table’s name is set manually through this property and the name is invalid, an exception is thrown.

The table’s name is considered to be valid, if the following conditions are met:

  • The name is not empty.
  • The name’s first character is a letter or underscore.
  • The rest of the name’s characters are letters, underscores, digits, or the following characters: ‘@’, ‘#’, ‘$’.
  • The corresponding DocumentTableSet object does not contain a DocumentTable instance with the same name.

Returns: java.lang.String - The name of this table used to access the table’s data in a template document passed to DocumentAssembler.

setName(String value)

public void setName(String value)

Sets the name of this table used to access the table’s data in a template document passed to DocumentAssembler.

If the table’s name is read from a document, the name is automatically corrected so that it to be valid. However, if the table’s name is set manually through this property and the name is invalid, an exception is thrown.

The table’s name is considered to be valid, if the following conditions are met:

  • The name is not empty.
  • The name’s first character is a letter or underscore.
  • The rest of the name’s characters are letters, underscores, digits, or the following characters: ‘@’, ‘#’, ‘$’.
  • The corresponding DocumentTableSet object does not contain a DocumentTable instance with the same name.

Parameters:

Parameter Type Description
value java.lang.String The name of this table used to access the table’s data in a template document passed to DocumentAssembler.

getIndexInDocument()

public int getIndexInDocument()

Gets the original zero-based index of the corresponding table as per the source document. Depending on an IDocumentTableLoadHandler implementation provided, this index may differ from the index of this DocumentTable instance within the table collection of the corresponding DocumentTableSet instance, if any.

Returns: int - The original zero-based index of the corresponding table as per the source document.

getColumns()

public DocumentTableColumnCollection getColumns()

Gets the collection of DocumentTableColumn objects representing columns of the corresponding table.

Returns: DocumentTableColumnCollection - The collection of DocumentTableColumn objects representing columns of the corresponding table.