GroupDocsGists
10/24/2017 - 1:09 PM

Examples-GroupDocs.Assembly.Examples.Java-src-main-java-com-groupdocs-assembly-examples-GenerateReport-changingDocumentTableColumnType.java

// 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"), table, "Managers");