Beispiel #1
0
DLLEXPORT int xlAutoOpen() {

    static XLOPER xDll;

    try {

        Excel(xlGetName, &xDll, 0);

        ObjectHandler::Configuration::instance().init();
        registerOhFunctions(xDll);

        Excel(xlFree, 0, 1, &xDll);
        return 1;

    } catch (const std::exception &e) {

        std::ostringstream err;
        err << "Error loading ObjectHandler: " << e.what();
        Excel(xlcAlert, 0, 1, TempStrStl(err.str()));
        Excel(xlFree, 0, 1, &xDll);
        return 0;

    } catch (...) {

        Excel(xlFree, 0, 1, &xDll);
        return 0;

    }
}
Beispiel #2
0
DLLEXPORT int xlAutoOpen() {

   init();

    XLOPER xDll;

    try {

        Excel(xlGetName, &xDll, 0);

#ifdef XLL_STATIC
        // Initialize configuration info
        ObjectHandler::Configuration::instance().init();

        // Initialize ObjectHandler functions
        registerOhFunctions(xDll);
#endif
        // Initialize QuantLib functions
        registerSBSAFunctions(xDll);

        // Initialize the Enumeration Registry
        QuantLibAddin::registerEnumerations();



        Excel(xlFree, 0, 1, &xDll);
        return 1;
    } catch (const std::exception &e) {
        std::ostringstream err;
        err << "Error loading sbsa xll objects: " << e.what();
        Excel(xlcAlert, 0, 1, TempStrStl(err.str()));
        Excel(xlFree, 0, 1, &xDll);
        return 0;
    } catch (...) {
        Excel(xlFree, 0, 1, &xDll);
        return 0;
    }
}
Beispiel #3
0
DLLEXPORT int xlAutoOpen() {

    // Instantiate the ObjectHandler Repository
    static ObjectHandler::RepositoryXL repositoryXL;

    static XLOPER xDll;

    try {

        Excel(xlGetName, &xDll, 0);

        ObjectHandler::Configuration::instance().init();

        registerOhFunctions(xDll);

        Excel(xlfRegister, 0, 7, &xDll,
            // function code name
            TempStrNoSize("\x07""qlClose"),
            // parameter codes
            TempStrNoSize("\x04""LEE#"),
            // function display name
            TempStrNoSize("\x07""qlClose"),
            // comma-delimited list of parameters
            TempStrNoSize("\x03""x,y"),
            // function type (0 = hidden function, 1 = worksheet function, 2 = command macro)
            TempStrNoSize("\x01""1"),
            // function category
            TempStrNoSize("\x07""Example"));

        Excel(xlfRegister, 0, 7, &xDll,
            // function code name
            TempStrNoSize("\x0D""qlSimpleQuote"),
            // parameter codes
            TempStrNoSize("\x04""CCE#"),
            // function display name
            TempStrNoSize("\x0D""qlSimpleQuote"),
            // comma-delimited list of parameters
            TempStrNoSize("\x0e""ObjectId,value"),
            // function type (0 = hidden function, 1 = worksheet function, 2 = command macro)
            TempStrNoSize("\x01""1"),
            // function category
            TempStrNoSize("\x07""Example"));

        Excel(xlfRegister, 0, 7, &xDll,
            // function code name
            TempStrNoSize("\xF3""qlSimpleQuoteValue"),
            // parameter codes
            TempStrNoSize("\x03""EC#"),
            // function display name
            TempStrNoSize("\xF3""qlSimpleQuoteValue"),
            // comma-delimited list of parameters
            TempStrNoSize("\x08""ObjectId"),
            // function type (0 = hidden function, 1 = worksheet function, 2 = command macro)
            TempStrNoSize("\x01""1"),
            // function category
            TempStrNoSize("\x07""Example"));

        Excel(xlFree, 0, 1, &xDll);
        return 1;

    } catch (const std::exception &e) {

        std::ostringstream err;
        err << "Error loading AddinXlHw: " << e.what();
        Excel(xlcAlert, 0, 1, TempStrStl(err.str()));
        Excel(xlFree, 0, 1, &xDll);
        return 0;

    } catch (...) {

        Excel(xlFree, 0, 1, &xDll);
        return 0;

    }
}