Error using AddDataSource

LCON posted this 20 March 2015


I am trying to use the AddDataSource function, as shown in this example :

However I can't use it because the function is not found in visual studio : "[...] Does not contain a definition for 'AddDataSource'[...]

I have included the following librairies : Docentric.Document.OjectModel,Docentric.Documents.Reporting,Docentric.Shared and DoumentFormat.OpenXml.

I have dowloaded the docentric trial version and I can't find the Docentric.Word librairy on my computer ( as requested here )

Moreover, I can't find the AddDataSource function in the documentation :

Is there a way to add a DataSource to a document generator ? I want to populate a template with attributes coming from different objects.


Last edited 20 March 2015

4 Posts
4 Points
Order By: Standard | Newest | Votes
admin posted this 20 March 2015


I'm sorry for the in convenience but with the release of version 2.0 we added a new assemby and made several changes and parts of our documentation is still not up-to-date.

The correct assemblies that you need to reference in your project:

  • Docentric.Documents.ObjectModel
  • Docentric.Documents.Reporting
  • Docentric.Shared
  • DocumentFormat.OpenXml

Providing data source values to the Report Engine: Each template always has a Default data source and can have 0 or more Named data sources. When you generate a document using the DocumentGenerator object, you can provide the value for the default data source via the DocumentGeneratorconstructor and if you have named data sources defined on the template, you can provide the value for each one using the DocumentGenerator.SetNamedDataSourceValue method (see the example at the end).

Let me know if this helps.

-- Jure

Last edited 20 March 2015

12 Posts
21 Points
LCON posted this 20 March 2015

Thanks for your quick answer, it worked !

4 Posts
4 Points

Our 30761 members have posted 271 times in 80 discussions