com.aspose.words
Class ReportingEngine

java.lang.Object
    extended by com.aspose.words.ReportingEngine

public class ReportingEngine 
extends java.lang.Object

Provides routines to populate template documents with data and a set of settings to control these routines.

Constructor Summary
ReportingEngine()
           Initializes a new instance of this class.
 
Property Getters/Setters Summary
KnownTypeSetgetKnownTypes()
           Gets an unordered set (i.e. a collection of unique items) containing java.lang.Class objects which fully or partially qualified names can be used in report templates processed by this engine instance to invoke the corresponding types' static members, perform type casts, etc.
static booleangetUseReflectionOptimization()
static voidsetUseReflectionOptimization(boolean value)
           Gets or sets a value indicating whether invocations of custom type members performed via reflection API are optimized using dynamic class generation or not. The default value is true.
 
Method Summary
voidbuildReport(Document document, java.lang.Object dataSource)
           Populates the specified template document with the data from the specified source.
voidbuildReport(Document document, java.lang.Object dataSource, java.lang.String dataSourceName)
           Populates the specified template document with the data from the specified source.
 

Constructor Detail

ReportingEngine

public ReportingEngine()
Initializes a new instance of this class.

Property Getters/Setters Detail

getKnownTypes

public KnownTypeSet getKnownTypes()
Gets an unordered set (i.e. a collection of unique items) containing java.lang.Class objects which fully or partially qualified names can be used in report templates processed by this engine instance to invoke the corresponding types' static members, perform type casts, etc.

getUseReflectionOptimization/setUseReflectionOptimization

public static boolean getUseReflectionOptimization() / public static void setUseReflectionOptimization(boolean value)
Gets or sets a value indicating whether invocations of custom type members performed via reflection API are optimized using dynamic class generation or not. The default value is true. There are some scenarios where it is preferrable to disable this optimization. For example, if you are dealing with small collections of data items all the time, then an overhead of dynamic class generation can be more noticeable than an overhead of direct reflection API calls.

Method Detail

buildReport

public void buildReport(Document document, java.lang.Object dataSource)
                throws java.lang.Exception
Populates the specified template document with the data from the specified source.

Using this overload you can reference the data source's members in the template document, but you can not reference the data source object itself. You should use buildReport(com.aspose.words.Document,java.lang.Object,java.lang.String) overload to achieve this.

Note, that data sources of the following types are processed in a special way by this method.

1. A System.Data.DataTable data source is processed as if its rows were passed instead of it. That is, you can only iterate over its rows in the template. The same is true for System.Data.DataView data sources.

2. A System.Data.DataRow data source is processed as if it was an instance of a type having fields matching this row's fields. You can also access this row's parent row and its child rows using the names of corresponding tables. The same is true for System.Data.DataRowView data sources.

3. A System.Data.DataSet data source is processed as if it was an instance of a type having fields matching tables contained within it and accessed by their names.

4. An System.Data.IDataReader data source is processed as if it represented an enumeration of System.Data.IDataRecord objects. Note, that an System.Data.IDataReader instance does not create separate System.Data.IDataRecord instances while advancing. That's why it is possible to use only plain and forward operations on such data sources. Note, that you also can not apply operations requiring an indirect caching of items such as grouping and sorting to System.Data.IDataReader data sources by the same reason. You should use System.Data.DataTable data sources instead if you need to use such operations.

5. An System.Data.IDataRecord data source is processed as if it was an instance of a type having fields matching this record's fields.

Note, that you should not use enumerations of items of the above types as data sources as well as System.Data.DataRowCollection objects, since the result becomes unspecified in this case.

Data source objects of other types are processed in a common way. That is, you can normally access their members and apply operations on them without any restrictions.

Parameters:
document - A template document.
dataSource - A data source object.

buildReport

public void buildReport(Document document, java.lang.Object dataSource, java.lang.String dataSourceName)
                throws java.lang.Exception
Populates the specified template document with the data from the specified source.

Using this overload you can reference the data source's members and the data source object itself in the template. If you are not going to reference the data source object itself, you can omit dataSourceName passing null or use buildReport(com.aspose.words.Document,java.lang.Object) overload.

Note, that data sources of the following types are processed in a special way by this method.

1. A System.Data.DataTable data source is processed as if its rows were passed instead of it. That is, you can only iterate over its rows in the template. The same is true for System.Data.DataView data sources.

2. A System.Data.DataRow data source is processed as if it was an instance of a type having fields matching this row's fields. You can also access this row's parent row and its child rows using the names of corresponding tables. The same is true for System.Data.DataRowView data sources.

3. A System.Data.DataSet data source is processed as if it was an instance of a type having fields matching tables contained within it and accessed by their names.

4. An System.Data.IDataReader data source is processed as if it represented an enumeration of System.Data.IDataRecord objects. Note, that an System.Data.IDataReader instance does not create separate System.Data.IDataRecord instances while advancing. That's why it is possible to use only plain and forward operations on such data sources. Note, that you also can not apply operations requiring an indirect caching of items such as grouping and sorting to System.Data.IDataReader data sources by the same reason. You should use System.Data.DataTable data sources instead if you need to use such operations.

5. An System.Data.IDataRecord data source is processed as if it was an instance of a type having fields matching this record's fields.

Note, that you should not use enumerations of items of the above types as data sources as well as System.Data.DataRowCollection objects, since the result becomes unspecified in this case.

Data source objects of other types are processed in a common way. That is, you can normally access their members and apply operations on them without any restrictions.

Parameters:
document - A template document.
dataSource - A data source object.
dataSourceName - A name to reference the data source object in the template.

See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.