Currently it's impossible to iterate over objects contained in UNO objects exposing XIndexAccess E.g., execute this macro in a writer document: Sub bookmks oDoc=thisComponent bookmarks = oDoc.Bookmarks For Each bookmark in bookmarks() print bookmark.Name Next bookmark End Sub This fails on "For Each" with "Inadmissible value or data type. Data type mismatch." error. One needs to use index access: Sub bookmks1 oDoc=thisComponent bookmarks = oDoc.Bookmarks For i = 0 to bookmarks.Count-1 print bookmarks.getByIndex(i).Name Next i End Sub I suppose that having the syntactic sugar for objects exposing XIndexAccess would be nice.
(In reply to Mike Kaganski from comment #0) > Currently it's impossible to iterate over objects contained in UNO objects > exposing XIndexAccess Of course, "impossible to iterate over objects using For Each" was meant.
(In reply to Mike Kaganski from comment #0) Hello i want to work on this enhancement. Please provide some pointers like at which file in source code we need to make changes. Thanks.
https://opengrok.libreoffice.org/xref/core/basic/source/runtime/runtime.cxx?r=adb38e36#1201 (away from this bug itself, but it seems For-Each on COM object fails)
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/5c502a100476c6b57a1a9f4305195c7e2d5d5608 tdf#130307 - Support for each loop for objects exposing XIndexAccess It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
You may open a new bug report for the COM objects himajin100000?
in addition to tdf#118241, a user is asking about the returned value of VBScript.RegExp's Execute method. https://ask.libreoffice.org/t/calc-vba-vbscript-regexp/52106