Apache OpenOffice (AOO) Bugzilla – Issue 23623
API: sw.SwXStyleFamily::XNameReplace
Last modified: 2017-10-11 17:30:01 UTC
Can't reset a given Container element. The following macro gets a style and then replaces it with another one. Trying to reset it to the previous style throws an IllegalArgumentException. oDoc = ThisComponent StyleFamily = oDoc.getStyleFamilies().getByIndex(0) 'StyleFamily.removeByName("SwXStyleFamily") aStyle = oDoc.createInstance("com.sun.star.style.CharacterStyle") aStyle.CharHeight=17 aStyle2 = oDoc.createInstance("com.sun.star.style.CharacterStyle") aStyle2.CharHeight=12 StyleFamily.insertByName("SwXStyleFamily", aStyle) 'getting old style oldStyle = StyleFamily.getByName("SwXStyleFamily") 'replacing the old Style with a new one StyleFamily.replaceByName("SwXStyleFamily", aStyle2) 'changing back to the default StyleFamily.replaceByName("SwXStyleFamily", oldStyle)
.
SW: doesn't seem to be essential for OOo2.0 => target=OOo later
Hi, I have the same issue. See my topic: https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=90648#p428914 In this case I can see with xRay the value for 3 paratabstops has been set correct. After using insertby name this value has been reset.
(In reply to Jan Flikweert from comment #3) > Hi, > > I have the same issue. See my topic: > https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=90648#p428914 > > In this case I can see with xRay the value for 3 paratabstops has been set > correct. After using insertby name this value has been reset. No. The errors in your macro have nothing to do with this issue. Hint: Delete the line oStyle.setName( "My new style") because with oPStyles.insertByName( "My new style", oStyle ) you create the name of the style. https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/Overall_Document_Features
https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=90648#p428992
(In reply to Jan Flikweert from comment #5) > https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=90648#p428992 I translated the java example: https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/Overall_Document_Features See my post on the forum: https://forum.openoffice.org/en/forum/viewtopic.php?f=20&t=90648#p429001