Closed somanuell closed 4 years ago
it's all good, but still need to be implemented (Value2Variant) w.Range("A1:B3").Value = [ ["A1", "B1"], ["A2", "B2"], ["A3", "B3"] ];
I will try to do it. (and thanks for merging the PR, I know some users of your addon who are super happy)
Hi, when trying to automate Excel, it is very handy, performance-wise, to be able to read large numbers of cells, using a rectangular "Range".
This PR calls a dedicated function when Variant2Array detects that the SAFEARRAY is a bidimentional one. The new function (called Variant2Array2) is very largely a variation of Variant2Array, except that there is two loops instead of one. The return value is a JavaScript Array of JavaScript Arrays. The most significant dimension is conventionally the rightmost in the SAFEARRAY.
With this PR, the following JavaScript code works:
The output is: A1:B3 Value is A1,B1,A2,B2,A3,B3 and the Visual Code debugger shows that Rect is indeed a native JavaScript Array of 3 "rows" each of them being a JavaScript Array of 2 columns.
Please let me know what you think about that code.