1

XLLoop is opensource framework to java. For example we can use function from java in excel. Below is very simple example of usage:

package org.boris.xlloop.util;

import org.boris.xlloop.FunctionServer;
import org.boris.xlloop.handler.*;
import org.boris.xlloop.reflect.*;

public class ServerExample
{
    public static void main(String[] args) throws Exception {
        // Create function server on the default port
        FunctionServer fs = new FunctionServer();

        // Create a reflection function handler and add the Math methods
        ReflectFunctionHandler rfh = new ReflectFunctionHandler();
        rfh.addMethods("Math.", Math.class);
        rfh.addMethods("Math.", Maths.class);
        rfh.addMethods("CSV.", CSV.class);
        rfh.addMethods("Reflect.", Reflect.class);

        // Create a function information handler to register our functions
        FunctionInformationHandler firh = new FunctionInformationHandler();
        firh.add(rfh.getFunctions());

        // Set the handlers
        CompositeFunctionHandler cfh = new CompositeFunctionHandler();
        cfh.add(rfh);
        cfh.add(firh);
        fs.setFunctionHandler(new DebugFunctionHandler(cfh));

        // Run the engine
        System.out.println("Listening on port " + fs.getPort() + "...");
        fs.run();
    }
}

I understand it and generally programm is working. But if I go to excel, it isn't working. I try:

=FS("Math.random")
=Math.random()

But I got #NAME? twice

So I suppose that I should make something yet. Could you tell me step by step how configure excel and java to do this? What should I do with xlloop-0.3.2 (Microsoft Excel XLL Add-In) file ?

3
  • What are you trying to achieve and where precisely are you stuck? Commented May 16, 2014 at 19:17
  • Please don't just post the URL which contains the code. Post the code here (and keep the source too). That way if the page ever dies, then we still understand the context of the question. Commented May 16, 2014 at 19:22
  • I edited my post. I think now is ok. Commented May 16, 2014 at 19:30

2 Answers 2

2

I tried running the code and I got the following output.

enter image description here

All I had to do was to launch Excel and add the XLLoop addin.

  • List item. Press Alt+G or click on the Go button beside Manage Excel Add-ins.
  • List item. Click on Browse and provide the path to the xlloop-0.3.2.xll file. If you had downloaded xlloop-0.3.2.zip,extract it and you will find it inside /xlloop/bin
  • List item

Hope that helps.

Edit:

  • Launch Excel.

  • Start the server(run the Main class) and test the formulas.

I tested the following 2(typed them on the Excel formula bar and hit/press Enter) and it worked fine. :)

  1. =FS("Math.sin", 3.14)
  2. =FS("Math.random")

enter image description here enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

It is very interesting. I was doing it exactly as you. But if I open excel file now, I got warning: postimg.org/image/kpq073g09 . Unfortunately, it isn't working. If i click Yes i see excel file and xlloop file which is really awful: postimg.org/image/i5temz5b7
I couldn't replicate your problem, had absolutely no issues with this.Please see my updated answer.
0

For anyone running into the same problem: You have to add the correct Addin Version to your excel installation.

If you are getting the error message: "The file format and extension [...] don't match.", it means that you are using a 64bit excel and the 32bit XLLoop addin.

You have to either install a 32bit Excel, or you have to get the 64bit version of the XLLoop Plugin.

We ran into the same problem, and created a 64bit version of the addin: https://github.com/PATRONAS/xlloop

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.