Issue 23623 - API: sw.SwXStyleFamily::XNameReplace
Summary: API: sw.SwXStyleFamily::XNameReplace
Status: ACCEPTED
Alias: None
Product: App Dev
Classification: Unclassified
Component: api (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Trivial
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-17 13:15 UTC by stephan.wunderlich
Modified: 2017-10-11 17:30 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description stephan.wunderlich 2003-12-17 13:15:27 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)
Comment 1 thomas.lange 2004-01-15 14:44:48 UTC
.
Comment 2 stephan.wunderlich 2004-05-03 12:41:19 UTC
SW: doesn't seem to be essential for OOo2.0 => target=OOo later
Comment 3 Jan Flikweert 2017-10-10 17:25:10 UTC
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.
Comment 4 mroe 2017-10-10 18:31:03 UTC
(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