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

            Bug ID: 96223
           Summary: SearchDescriptor Properties cannot be set in 5.1
           Product: LibreOffice
           Version: 5.1.0.0.beta1
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

I have a macro which searches through text to find unlinked URLs and linkify
them. It uses a SearchDescriptor and regular expressions:

    oSearch = oDocument.createSearchDescriptor
    oSearch.SearchRegularExpression = TRUE

This creates a new descriptor and then enables regex mode. This FAILS in 5.1,
and looking at the object it does not expose the SearchRegularExpression
property to modify. Is this an API change undocumented in
https://wiki.documentfoundation.org/ReleaseNotes/5.1#API_changes or a bug?

The full macro is below, which works fine in 5.0.3:


Sub makeURLs()
    Dim oDocument As Object
    Dim oSearch As Object, oFound As Object
    Dim oFoundCursor As Object
    Dim reURL As String
    Dim doistring as String
    Dim URL as String

    reURL = "(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)"
    URL = ""
    doistring = "dx.doi.org"
    oDocument = ThisComponent
    oSearch = oDocument.createSearchDescriptor
    oSearch.SearchRegularExpression = TRUE
    oSearch.SearchString = reURL
    oFound = oDocument.findFirst(oSearch)
    While NOT IsNull(oFound)
        URL = oFound.String
        If InStr(URL, doistring) Then
            oFound.HyperlinkName = "DOI"
            REM    oFound.String = "DOI"
        Else
            oFound.HyperlinkName = "URL"
        End If
        oFound.HyperlinkTarget = ""
        oFound.HyperlinkURL = URL
        oFound = oDocument.findNext(oFound, oSearch)
        URL=""
    Wend

End Sub

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to