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

            Bug ID: 173614
           Summary: SetReplaceAttributes w/ CharStyleName + replaceAll()
                    fails silently
           Product: LibreOffice
           Version: 26.8.0.3 release
          Hardware: Other
                OS: macOS (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

Description:
In a (Basic) macro, attempting to assign a predefined character style to some
collection of found characters via replaceAll() fails silently, but still
reports the correct number of replacements.

Steps to Reproduce:
1. Open or create a document with some text in it. (For the below macro, it
must contain at least one "a".)
2. Paste the below macro into a module.
3. Run it.

Sub TestReplaceAllCharStyleName
    Dim oReplace As Object
    Dim ReplAttribs(0) As New com.sun.star.beans.PropertyValue

    oReplace = ThisComponent.createReplaceDescriptor()
    oReplace.SearchString = "a"
    oReplace.ReplaceString = "a"

    ' This will fail silently
    ReplAttribs(0).Name = "CharStyleName"
    ReplAttribs(0).Value = "Endnote Anchor" ' Choice of value doesn't affect
problem

    ' This will work as expected
    'ReplAttribs(0).Name = "CharWeight"
    'ReplAttribs(0).Value = com.sun.star.awt.FontWeight.BOLD

    oReplace.SetReplaceAttributes(ReplAttribs())

    MsgBox ThisComponent.replaceAll(oReplace)
End Sub


Actual Results:
The correct/expected number of replacements will be reported, but no style
assignment actually occurs.

Expected Results:
All instances of the search criteria should be assigned the named character
style.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
System info
------------
MacBook Air
Apple M1
macOS Tahoe 26.3.1 (a) (25D771280a)

LibreOffice info
----------------
Version: 26.8.0.3 (AARCH64)
Build ID: bce0998afefdbc355585ca324285661a2170ba77
CPU threads: 8; OS: macOS 26.3.1; UI render: Skia/Raster; VCL: osx
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to