Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot register new custom function #90

Open
Aleksa-Amp opened this issue Jan 25, 2021 · 1 comment
Open

Cannot register new custom function #90

Aleksa-Amp opened this issue Jan 25, 2021 · 1 comment

Comments

@Aleksa-Amp
Copy link

Aleksa-Amp commented Jan 25, 2021

I am trying to register new custom expression function:

return new DocxStamperConfiguration()
            .exposeInterfaceToExpressionLanguage(TestFunction.class, new TestFunctionImpl())
            .build();
public interface TestFunction{
        void test();
    }

    public static class TestFunctionImpl implements TestFunction{
        @Override
        public void test() {
            System.out.println("Test");
        }
    }

But once I try to process document I get the following error:

IllegalArgumentException: object is not an instance of declaring class

This is the expression in my docx file: ${test()}.
How can I solve this problem?

@caring-coder
Copy link

Works without issues in current version of our fork office-stamper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants