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

            Bug ID: 165244
           Summary: Macro code to change the font family for a Style works
                    in version 24.8, but fails in LO 25.2
           Product: LibreOffice
           Version: 25.2.0.0 alpha0+
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: [email protected]
          Reporter: [email protected]

Description:
LO Writer macro code that works in LO 24.8 fails in 25.2:


dim oFamilies as object
dim oStyleDefault as object
dim oStyleHeading as object     

oFamilies = ThisComponent.StyleFamilies.getByName("ParagraphStyles")
oStyleDefault = oFamilies.getByName("Default Paragraph Style")  <<-- ERROR HERE
oStyleDefault.CharFontName = "Liberation Serif"
oStyleDefault.CharHeight = 12

The line: oFamilies.getByName("Default Paragraph Style")

Fails with the message:

BASIC runtime error.
An exception occurred 
Type: com.sun.star.container.NoSuchElementException
Message: Default Paragraph Style.

The same error occurs with oFamilies.getByName("Body Text")

This code works in LO 24.8, but errors in 25.2

Interestingly, it works in 25.2 with Heading 1:

oStyleDefault = oFamilies.getByName("Heading 1")


Steps to Reproduce:

dim oFamilies as object
dim oStyleDefault as object
dim oStyleHeading as object     

oFamilies = ThisComponent.StyleFamilies.getByName("ParagraphStyles")
oStyleDefault = oFamilies.getByName("Default Paragraph Style")  <<-- ERROR HERE
oStyleDefault.CharFontName = "Liberation Serif"
oStyleDefault.CharHeight = 12

Actual Results:
The line: oFamilies.getByName("Default Paragraph Style")

Errors with the message:

BASIC runtime error.
An exception occurred 
Type: com.sun.star.container.NoSuchElementException
Message: Default Paragraph Style.

The same error occurs with oFamilies.getByName("Body Text")

This code works in LO 24.8, but errors in 25.2

Interestingly, it works in 25.2 with Heading 1:

oStyleDefault = oFamilies.getByName("Heading 1")

Expected Results:
The macro code should work in version 25.2 just as it does in version 24.8


Reproducible: Always


User Profile Reset: No

Additional Info:
see included code

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

Reply via email to