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
This started to fail after commit ea84220a7558508dd906c402d68da532b664a20a [log] author Michael Stahl <michael.stahl@allotropia.de> Thu Dec 05 12:22:14 2024 +0100 committer Michael Stahl <michael.stahl@allotropia.de> Mon Dec 09 20:51:08 2024 +0100 tree 944ec7525254e57eaffd8062ec6aca18e15d2f8f parent 130478ca19dec874a043f4c9d4977aca7fb19cc2 [diff] tdf#159549 sw: fix ODF import of newly colliding Body Text styles I believe you macro has to be adapted to dim oFamilies as object dim oStyleDefault as object dim oStyleHeading as object oFamilies = ThisComponent.StyleFamilies.getByName("ParagraphStyles") oStyleDefault = oFamilies.getByName("Standard") oStyleDefault.CharFontName = "Liberation Serif" oStyleDefault.CharHeight = 12 Closing as RESOLVED NOTABUG
The changed line: oStyleDefault = oFamilies.getByName("Standard") Does not error, but it also has no effect on the "Body Text" style. It did not appear toaffect any Text or Heading style.