Generate Your First Document from .NET Object
Leave feedback
Overview
This guide walks you through creating your first document with GroupDocs.Assembly for .NET. You’ll generate a simple document from an in-memory .NET object, demonstrating the basic workflow of template-based document assembly.
Name: John Doe
Age: 30
Email: john.doe@example.com
Using Contextual Object Member Access
You can also use contextual member access, which allows you to omit the data source name in simple scenarios:
publicstaticvoidGenerateDocumentWithContextualAccess(){Personperson=newPerson{Name="Jane Smith",Age=28,Email="jane.smith@example.com"};DocumentAssemblerassembler=newDocumentAssembler();// When using contextual access, you can omit the data source nameassembler.AssembleDocument("Template.docx","Output.docx",newDataSourceInfo(person));}
When using contextual object member access, the template expressions can reference properties directly without the data source name prefix. This is useful for simple, single-object scenarios.
Advanced Usage Topics
To learn more about working with complex data structures, multiple data sources, and advanced template syntax, please refer to the advanced usage section.
More resources
GitHub Examples
You may easily run the code above and see the feature in action in our GitHub examples: