Changing Automatically Detected Types of DocumentTable Columns

Note
The code uses some of the objects defined in The Business Layer.

Changing Automatically Detected Types

API provides the ability to change automatically detected types of DocumentTable columns. The Type property setter has been added to the GroupDocs.Assembly.Data.DocumentTableColumn class.

Moreover, The Relations property of the GroupDocs.Assembly.Data.DocumentTableSet class has been added.

Download

Data Source Document

Template

Changing Document Table Column Type

// For complete examples and data files, please go to https://github.com/groupdocs-assembly/GroupDocs.Assembly-for-Java
// Set table column names to be extracted from the document.
DocumentTableOptions options = new DocumentTableOptions();
options.setFirstRowContainsColumnNames(true);
DocumentTable table = new DocumentTable(CommonUtilities.wordDataFile +"/Managers Data.docx", 1, options);
// NOTE: For non-Spreadsheet documents, the type of a document table column is always string by default.
assert table.getColumns().get("Total_Contract_Price").getType() == String.class;
// Change the column's type to double thus enabling to use arithmetic operations on values of the column
// such as summing in templates.
table.getColumns().get("Total_Contract_Price").setType(double.class);
// Pass DocumentTable as a data source.
DocumentAssembler assembler = new DocumentAssembler();
assembler.assembleDocument(CommonUtilities.getDataPath(doc), CommonUtilities.getOutPath("/Presentation Reports/out.pptx"), new DataSourceInfo(table, "Managers"));
Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.