[Libreoffice-bugs] [Bug 130307] New: Support For Each loop for objects exposing XIndexAccess

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Fri Jan 31 08:38:01 UTC 2020


https://bugs.documentfoundation.org/show_bug.cgi?id=130307

            Bug ID: 130307
           Summary: Support For Each loop for objects exposing
                    XIndexAccess
           Product: LibreOffice
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: medium
         Component: BASIC
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: mikekaganski at hotmail.com

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.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20200131/ff29a98a/attachment.htm>


More information about the Libreoffice-bugs mailing list