Provides access to data of multiple tables (or spreadsheets) located in an external document to be used while assembling a document. Also enables defining parent‑child relations for the document tables, simplifying access to related data within template documents.
For documents of spreadsheet file formats, a DocumentTableSet instance represents a set of sheets. For documents of other file formats, a DocumentTableSet instance represents a set of tables.
To access data of the corresponding tables while assembling a document, pass an instance of this class as a data source to one of DocumentAssembler overloads.
In template documents, a DocumentTableSet instance should be treated the same way as a System.Data.DataSet instance. See the template syntax reference for more information.
The DocumentTableSet type exposes the following members:
The collection of DocumentTable objects representing tables of this set.
Example
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=options# Load all tables from an Excel filetables=DocumentTableSet("related-tables.xlsx",load_table)# Define parent‑child relations between tablestables.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"])# Use the tables as a data source for document assemblyassembler=DocumentAssembler()assembler.assemble_document("table-relations.docx","table-relations-report.docx",DataSourceInfo(tables))