DocumentGenerator Class |
Docentric Toolkit Help
Send Feedback |
Used to generate report documents by populating report template .docx files with data.
System.Object
Docentric.Documents.Reporting.DocumentGenerator
Assembly: Docentric.Documents.Reporting (in Docentric.Documents.Reporting.dll)
public class DocumentGenerator
The DocumentGenerator type exposes the following members.
Name | Description | |
---|---|---|
.ctor(Object) | Initializes a new instance of the DocumentGenerator class. |
Name | Description | |
---|---|---|
DefaultDataSource | Returns the default data source object. | |
ElementProcessingExclusionRule | Gets or sets the rule for excluding the template elements from the generation process. This property is used in combination with the 'FinalizeDocument' property. Content controls of the excluded elements do not get deleted from the document. | |
FinalizeDocument | Get or sets the value indicating weather the generated document should retain its project data. If the property is set to 'True', the generated document will retain its project data and hence considered as a templated which can be processed again. The default value for this proprty is set to 'True'. | |
NamedDataSources | Returns a collection of all named data sources. | |
WriteErrorsAndWarningsToDocument |
Name | Description | |
---|---|---|
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object) | |
GenerateDocument(String, String) | Generates an MS Word document by providing the report template file name and the output document file name. The format of the output document will be inferred from the file extension. | |
GenerateDocument(String, String, SaveOptions) | Generates a document by providing the report template file name, the output document file name and the save options. | |
GenerateDocument(Stream, Stream) | Generates a document by providing the report template stream and the output document stream. The output document will be written as an MS Word (docx) document. | |
GenerateDocument(Stream, Stream, SaveOptions) | Generates a document by providing the report template stream, the output document stream and the save options. | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object) | |
GetType | Gets the Type of the current instance. (Inherited from Object) | |
SetDefaultDataSourceValue | Sets the value for the default data source. | |
SetNamedDataSourceValue | Sets the value for the named data source defined by the report template. The name of the data source must be one of the data sources defined in the report template. | |
ToString | Returns a String that represents the current Object. (Inherited from Object) |
Name | Description | |
---|---|---|
ElementInitialize | Occurs when the document generator finds and initializes an instance of an element. | |
LabelRequest | Occurs when a label translation is getting obtained. Use this event to provide a label tarnslation for a given label code and culture. |
The GenerateDocument is the main class ToString and represents the Docentric Report Engine itself. To run the document generation call the DocumentGenerator method.
This example shows
how to generate a document form a simple template.
IEnumerable<Customer> customers = DataAccess.GetCustomerById(15); DocumentGenerator dg = new DocumentGenerator(customer); dg.SetNamedDataSourceValue("Products", products); DocumentGenerationResult result = dg.GenerateDocument("MyTemplate.docx", "MyReport.docx"); if (result.HasErrors) { foreach (Error error in result.Errors) Console.WriteLine(error); }