durs / node-activex

Node.JS Implementaion of ActiveXObject
MIT License
329 stars 62 forks source link

Fix in Variant2Array for SAFEARRAY with lLbound != 0 #67

Closed somanuell closed 4 years ago

somanuell commented 4 years ago

Hi durs,

Excel generally returns SAFEARRAY with the first index of each dimension set to 1, not 0. I think it is related to some sort of Legacy about Excel Macro, VBA, and the ancestors of COM.

While modifying your code to be able to process two dimensional SAFEARRAY ((which is somehow mandatory if you want to interact with Excel), I found this bug on the lower limits, therefore this PR.

Would you be interested in another PR allowing Variant2Array to process two dimensional SAFEARRAY (returning a JS array of arrays, in this case)?

Manuel

durs commented 4 years ago

Thanks for the fix, until it became necessary to use two-dimensional arrays, but it might come in handy for someone

somanuell commented 4 years ago

I personally think the 2 dimensional SAFEARRAY are not "handy", but "mandatory", if you want to automate Excel. Reading cells one by one comes with a huge performance penalty...

I will make the Pull Request. You can just look at the code and give me your opinion.