Does assembly supports custom code execution during the rendering process?

Greetings.

Imagine I have JSON data like the following:

{
    "data": "<p><a href="http://mysite.com/tutorial.pdf">Tutorial PDF</a></p>"
}

I can use the following statement to print the value nicely on a Word document:

<<[data] -html>>

But, I also need to execute some code based on what’s in the value of the “data” field.
For example, I want to download the file pointed to by the href attribute and attach it to the file being generated.

Does Assembly supports a callback mechanism or custom tags that allow me to
execute arbitrary code during rendering?

Thanks in advance,

  • Elliot

Java 17
Assembly 22.2

1 Like

@evargaslexipol

We are investigating this scenario. Your investigation ticket ID is ASSEMBLYJAVA-26. We’ll notify you in case of any update.

@evargaslexipol

We have an update on ASSEMBLYJAVA-26.
GroupDocs.Assembly supports execution of custom code through invocation of members of custom types. Consider the following template:

<<[Util.doSomething(data)]>>

The template can be used to invoke the doSomething method of the Util class that can be defined in client code as follows:

//Java codde
public class Util {
    public static String doSomething(String value) {
        // Do whatever is needed.

        return ""; // It is required to return a value in order to invoke the member by GroupDocs.Assembly.
    }
}

Note that according to this article, DocumentAssembler should be made aware of Util.class as follows:

DocumentAssembler assembler = new DocumentAssembler();
assembler.getKnownTypes().add(Util.class);
assembler.assembleDocument(...);