If you are an Excel power user please have a look at https://xlladdins.com. It is still in early stages so any feedback will be appreciated. Currently there are add-ins for the C/C++ math library and Windows registry. The add-ins are signed but until I scrape up enough nickels for an EV (“Expensive Validation”) CA you will still see warnings when opening them in Excel. Who says money can’t buy you friends?
If that makes you nervous then you can build everything from source for yourself using the free version of Visual Studio. It should be as simple as cloning the repository in VS and hitting F5. Let me know if that does not work for you.
The xll_math
library uses a python script to scrape the documentation from web pages and generate C++ code. I work hard to be lazy. The xll_registry
library scratches an itch that I am surprised nobody else has scratched. Even VBA does not come equipped with this functionality.
This is probably one of the best pieces of support software that I have come across. Brilliant work! And it answers probably 100 questions posed on Stackoverflow as to how best to integrate C++ with Excel. Only reason that it doesn’t answer more SO questions is that it is only for Windows 😉 Sorry Mac and Linux crew.
One request: have an option for MyArray to return a horizontal array to Excel, rather than only a vertical array. Most (of my actuarial) cashflow based work is member-based and is horizontal.
Am still messing around with it. Will definitely give more feedback as I work through it.
Thanks for your kind comments and feedback. I’ll put https://github.com/xlladdins/xll_range next on my list to roll out. The RANGE.RESIZE function can be used for that but maybe I should add a RANGE.TRANSPOSE. Transpose for row or column vectors is trivial, but the general nxm case is non-trivial.
Hi Kalx,
please see at line 361(xll_range) .
my question is: Why don’t you use OPER instead of XLOPERX, there are quite a few datatypes and they distract me.
Is there any difference there? please clarify this..
https://github.com/xlladdins/xll#the-4-and-12-suffixes
Hi,I have 2nd question:
at line 406: we have: o = range_drop(*pr, n);
Does passing this parameter need to be reference? or should I keep the pointer:
I meant:
o = range_drop(pr, n);
inline XLOPERX range_take(LPOPER x1, long i) //<– or XLOPERX&
{
XLOPERX x=*x1;
}
I mean performance effect?
Excel functions do not take references.
Hi,
Thank you for the 2 answers.
I have more peace of mind now.
Hi Kalx,
Can you watch it again! I was mistaken,
these codes at line 356 and 310.
Hi Kalx,
When I declare the code
static xll::FPX o1(rows,cols); o1 does not resize itself on the 2nd call.
can you fix it instead of using o1.resize?
also I have a jagged 2D double vector.
how should i use the code to declare o1 with all elements initialized to =0.0 so I can end loop early.
a little bit of my stupid laziness !
Static variables are only constructed once.
The FP datatype does not handle jagged arrays.
Use memset or std::fill to set memory.
Hi Kalx,
When I click on the develope->addin tab and deactivate it however the intellisense function still works.
Is it possible to turn it off?
This is a known issue with Excel. The function Unregister will remove an add-in given the function name. https://github.com/xlladdins/xll/blob/efcf52e6da0286f15e09cb6bb83f92eeedfa460a/xll/register.h#L87
Thanks you.
they are clear to me now.
Hi,
How do i check the number of rows and columns returned from vector is out of bounds (eg xls ~65k and xlsx 1millions)
i found this but sample code can’t compile them in my functions.
ensure(r <= (unsigned)(std::numeric_limits::max)());
ensure(c <= (unsigned)(std::numeric_limits::max)());
Have a look at the numeric_limits documentation.
Hi Kalx,
Thanks you. Turns out I got it wrong, it returned the datatype limit.
I’ll probably need to find something like app.rows.count or app.sheet(0).rows.count
How should I approach it?
Hi,
I’ve got a solution. Great to start exploring these things.
Have a nice weekend !
Hi Kalx,
When I use the LPOPER parameter to get a reference of rectang (ex: “B2:C3”), the sref value returns the wrong lastcolumn value.
Is this by design?
Yes.
Hi, Ok.
I think it is possible to extend the LPOPER parameter so it returns a sref containing colfirst,last/rowf,rowl to help locate its address as well as sheetID information to know which sheet the reference area is from. may be useful for later functions.
for example B2:E3 rowf=1/colf=1/rowl=2/coll=4
Hi Keith
In the previous version of xll12 you removed compatibility with Excel4 or all versions before 2007. Working with Excel12 only really simplified the code a lot. Why did you reintroduce it in this version?
Hi Dan. You should use https://github.com/xlladdins/xll. All versions have supported both Excel4 and Excel12.
Do you have an example of what is more complicated?
I used version from here https://github.com/keithalewis/xll12
By complicated I mean that many classes became templated to support both Excel4 and Excel12.
By the way I have another question . Could not figure this out from documentation:
When I return string inside LPXLOPER from function, do I need to set xlbitDLLFree ?
I forgot that xll12 did not support old versions of Excel. In the new xll you can still use OPER, Excel, etc. and they are typedefed to use the Excel12 versions by default. The new version uses utf-8 everywhere so you don’t need to bother with wide strings.
When returning an LPXLOPER that is a string you need to tell Excel how you allocated the memory. The easiest is to declare a static OPER in the function to ensure the memory lives after the function returns.