Using Aspose library in template syntax

Hi Aspose team,

I’m working on a template to produce a document with the ReportingEngine with a json as data source and template.

And looking for some explanation on how I can use the by aspose provided classes in the template syntax.

In the java code I can instantiate an object and apply the methods to it. i.e setBold() needs an instance and can be done in the java code. But how do I use that Font class in the template ?

when I add the class to the engine as below, :
engine.getKnownTypes().add(Font.class);

and then in the template reference this class:
<<[Font.setBold(true)]>>
gives a error:
Exception in thread “main” java.lang.IllegalStateException: An error has been encountered at the end of expression ‘Font.setBold(true)]>’. Can not resolve method ‘setBold’ on type ‘class com.aspose.words.Font’.
at com.aspose.words.internal.zzQA.zzZ(Unknown Source)
at com.aspose.words.internal.zzQA.zzZ(Unknown Source)
at com.aspose.words.internal.zzGE.zzC6(Unknown Source)
at com.aspose.words.internal.zzUO.zzUF(Unknown Source)
at com.aspose.words.internal.zzUO.zzUG(Unknown Source)
at com.aspose.words.internal.zzUO.zzUH(Unknown Source)
at com.aspose.words.internal.zzGE.zzZ(Unknown Source)
at com.aspose.words.internal.zzGE.zzZ(Unknown Source)
at com.aspose.words.internal.zz99.zzZ(Unknown Source)
at com.aspose.words.internal.zz99.zzZ(Unknown Source)
at com.aspose.words.ReportingEngine.buildReport(Unknown Source)
at com.aspose.words.ReportingEngine.buildReport(Unknown Source)

Any help is appreciated.

Many thanks, Jeffrey

@Jeffrey1

Unfortunately, you cannot use the APIs in template syntax. Please read following article about setting up know external types.
Setting up Known External Types

Could you please share some detail about your use case and requirement along with input and expected output documents? We will then provide you more information about your query.