Add DateTime.Now.AddDays(1) to Linq Reporting Engine template

Hi,

I’m trying to add the expression "<<[DateTime.Now.AddDays(1)]:"yyyy.MM.dd">>" to a Linq Reporting Engine template, but I keep getting an error like “An error has been encountered at the end of expression ‘DateTime.N’. Can not get the value of member ‘DateTime’ on type ‘System.Data.DataRow’.”

What is the syntax to add a global, static .NET method expression to a Linq Reporting Engine template? I don’t see any examples of this in your documentation, either.

Hi Ted,

Thanks for your inquiry. Please refer to the following article:
Setting up Known External Types

Please use ReportingEngine.KnownTypes property as shown below to get the desired output. We have attached the input and output documents with this post for your kind reference.

var doc = new Document(MyDir + "in.docx");
ReportingEngine engine = new ReportingEngine();
engine.KnownTypes.Add(typeof(DateTime));
engine.BuildReport(doc, DateTime.Now);
doc.Save(MyDir + "Out v17.2.0.docx");