TemplateTable
Leave feedback
On this page
Inheritance: java.lang.Object, com.groupdocs.parser.templates.TemplateItem
public class TemplateTable extends TemplateItem
Provides the template table.
There are two ways to define a table:
- Using TemplateTableLayout class. In this case the table is defined by its position on the page: rectangular area, columns and rows separators.
- Using TemplateTableParameters class. In this case the table is detected automatically by algorithms with set parameters. See TemplateTableParameters class for more information.
| Method | Description |
|---|---|
| getLayout() | Gets the table layout. |
| getParameters() | Gets the parameters to detect the table in the automatic mode. |
| scale(double factor) |
public TemplateTable(TemplateTableLayout layout, String name, Integer pageIndex)
Initializes a new instance of the TemplateTable class with the UPPER CASE name.
Template table is set by table layout if the table can’t be detected automatically:
TemplateTableLayout layout = new TemplateTableLayout(
java.util.Arrays.asList(new Double[] { 50.0, 95.0, 275.0 }),
java.util.Arrays.asList(new Double[] { 325.0, 340.0, 365.0 }));
TemplateTable table = new TemplateTable(layout, "Details", null);
// Create a document template
Template template = new Template(java.util.Arrays.asList(new TemplateItem[] { table }));
Parameters:
| Parameter | Type | Description |
|---|---|---|
| layout | TemplateTableLayout | The table layout. |
| name | java.lang.String | The table name. |
| pageIndex | java.lang.Integer | The index of the page where the template table is located; null if the template table is located on any page. |
public TemplateTable(TemplateTableLayout layout, String name, Integer pageIndex, Double pageWidth)
Initializes a new instance of the TemplateTable class with the UPPER CASE name.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| layout | TemplateTableLayout | The table layout. |
| name | java.lang.String | The table name. |
| pageIndex | java.lang.Integer | The index of the page where the template table is located; null if the template table is located on any page. |
| pageWidth | java.lang.Double | The width of the page that was used to create the template item. |
public TemplateTable(TemplateTableLayout layout, String name, Integer pageIndex, boolean useUpperCaseName)
Initializes a new instance of the TemplateTable class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| layout | TemplateTableLayout | The table layout. |
| name | java.lang.String | The table name. |
| pageIndex | java.lang.Integer | The index of the page where the template table is located; null if the template table is located on any page. |
| useUpperCaseName | boolean | The value that indicates whether a name is converted to UPPER CASE. |
TemplateTable(TemplateTableLayout layout, String name, Integer pageIndex, Double pageWidth, boolean useUpperCaseName)
public TemplateTable(TemplateTableLayout layout, String name, Integer pageIndex, Double pageWidth, boolean useUpperCaseName)
Initializes a new instance of the TemplateTable class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| layout | TemplateTableLayout | The table layout. |
| name | java.lang.String | The table name. |
| pageIndex | java.lang.Integer | The index of the page where the template table is located; null if the template table is located on any page. |
| pageWidth | java.lang.Double | The width of the page that was used to create the template item. |
| useUpperCaseName | boolean | The value that indicates whether a name is converted to UPPER CASE. |
public TemplateTable(TemplateTableParameters parameters, String name, Integer pageIndex)
Initializes a new instance of the TemplateTable class with the UPPER CASE name.
If a template table is set by detector parameters, the table is detected automatically:
TemplateTableParameters parameters = new TemplateTableParameters(
new Rectangle(new Point(175, 350), new Size(400, 200)),
java.util.Arrays.asList(new Double[] { 185.0, 370.0, 425.0, 485.0, 545.0 }));
TemplateTable table = new TemplateTable(parameters, "Details", 0);
// Create a document template
Template template = new Template(java.util.Arrays.asList(new TemplateItem[] { table }));
Parameters:
| Parameter | Type | Description |
|---|---|---|
| parameters | TemplateTableParameters | The parameters to detect the table in the automatic mode. |
| name | java.lang.String | The table name. |
| pageIndex | java.lang.Integer | The index of the page where the template table is located; null if the template table is located on any page. |
public TemplateTable(TemplateTableParameters parameters, String name, Integer pageIndex, Double pageWidth)
Initializes a new instance of the TemplateTable class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| parameters | TemplateTableParameters | The parameters to detect the table in the automatic mode. |
| name | java.lang.String | The table name. |
| pageIndex | java.lang.Integer | The index of the page where the template table is located; null if the template table is located on any page. |
| pageWidth | java.lang.Double | The width of the page that was used to create the template item. |
TemplateTable(TemplateTableParameters parameters, String name, Integer pageIndex, boolean useUpperCaseName)
public TemplateTable(TemplateTableParameters parameters, String name, Integer pageIndex, boolean useUpperCaseName)
Initializes a new instance of the TemplateTable class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| parameters | TemplateTableParameters | The parameters to detect the table in the automatic mode. |
| name | java.lang.String | The table name. |
| pageIndex | java.lang.Integer | The index of the page where the template table is located; null if the template table is located on any page. |
| useUpperCaseName | boolean | The value that indicates whether a name is converted to UPPER CASE. |
TemplateTable(TemplateTableParameters parameters, String name, Integer pageIndex, Double pageWidth, boolean useUpperCaseName)
public TemplateTable(TemplateTableParameters parameters, String name, Integer pageIndex, Double pageWidth, boolean useUpperCaseName)
Initializes a new instance of the TemplateTable class.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| parameters | TemplateTableParameters | The parameters to detect the table in the automatic mode. |
| name | java.lang.String | The table name. |
| pageIndex | java.lang.Integer | The index of the page where the template table is located; null if the template table is located on any page. |
| pageWidth | java.lang.Double | The width of the page that was used to create the template item. |
| useUpperCaseName | boolean | The value that indicates whether a name is converted to UPPER CASE. |
public TemplateTableLayout getLayout()
Gets the table layout.
Returns: TemplateTableLayout - An instance of TemplateTableLayout class that represents the table layout; null if it isn’t set.
public TemplateTableParameters getParameters()
Gets the parameters to detect the table in the automatic mode.
Returns: TemplateTableParameters - An instance of TemplateTableParameters class that represents the parameters to detect the table in the automatic mode; null if it isn’t set.
public TemplateItem scale(double factor)
Creates a copy of the current item with all coordinates scaled by the given factor.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| factor | double |
Returns: TemplateItem
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.