Defining Relations Between DocumentTable Instances Loaded from a Single Document
Defining Relations Between DocumentTable Instances Loaded from a Single Document
Leave feedback
Define Relations Between Document Table Instances
API provides ability to define relations between DocumentTable instances loaded from a single document. The following classes of the GroupDocs.Assembly.Data namespace have been added:
fromgroupdocs.assemblyimportDataSourceInfo,DocumentAssemblerfromgroupdocs.assembly.dataimportDocumentTableOptions,DocumentTableSetdefload_table(args):# The first row of every table holds its column namesoptions=DocumentTableOptions()options.first_row_contains_column_names=Trueargs.options=optionstables=DocumentTableSet("related-tables.xlsx",load_table)tables.relations.add(tables.tables["CLIENT"].columns["ID"],tables.tables["CONTRACT"].columns["CLIENT_ID"])tables.relations.add(tables.tables["MANAGER"].columns["ID"],tables.tables["CONTRACT"].columns["MANAGER_ID"])assembler=DocumentAssembler()assembler.assemble_document("table-relations.docx","table-relations-report.docx",DataSourceInfo(tables))