Apache OpenOffice (AOO) Bugzilla – Issue 2449
Cannot get CharCaseMap from a textrange
Last modified: 2013-02-24 21:07:09 UTC
It looks as if the property CharCaseMap is write-only at the moment. I can set a word to lowercase with code like: oCursor.CharCaseMap=com.sun.star.style.CaseMap.LOWERCASE but if I try to examine the state of this property, it breaks: dim sCase as short ... sCase=oCursor.CharCaseMap gives an error, as does oCursor.CharCaseMap=com.sun.star.style.CaseMap.LOWERCASE msgbox "Case= " + oCursor.GetPropertyState("CharCaseMap") Both say that the property is missing, although I have just set it.
It turns out that there is a way to do this: vCursor.getPropertyValue("CharCaseMap") returns the property which, according to the API documentation, should be returned by vCursor.CharCaseMap(). I think the documentation should be changed.
for a OpenOffice.org/Writer version 641c document: this works: oCursor = ThisComponent.getText().createTextCursor() ' msgoCursor = ThisComponent.getText().createTextCursor() oCursor.CharCaseMap=com.sun.star.style.CaseMap.LOWERCASE msgbox "Case= " + oCursor.GetPropertyState("CharCaseMap")box oCursor.dbg_supportedinterfaces print oCursor.GetPropertyState( "CharCaseMap" ) this works too: oCoCursor = ThisComponent.getText().createTextCursor() oCursor.CharCaseMap=com.sun.star.style.CaseMap.LOWERCASE msgbox "Case= " + oCursor.GetPropertyState("CharCaseMap")ursor = ThisComponent.getText().createTextCursor() ' msgbox oCursor.dbg_supportedinterfaces print oCursor.getPropertyState( "CharCaseMap" ) so does this: oCursor = ThisComponent.getText().createTextCursor() ' msgbox oCursor.dbg_supportedinterfaces print oCursor.getPropertyValue( "CharCaseMap" ) and this: oCursor = ThisComponent.getText().createTextCursor() ' msgbox oCursor.dbg_supportedinterfaces print oCursor.CharCaseMap and finally this works too: ThisComponent.getText().createTextCursor() oCursor.CharCaseMap=com.sun.star.style.CaseMap.LOWERCASE msgbox "Case= " + oCursor.GetPropertyState("CharCaseMap") In YOUR first example, there seems to be a problem with the "dim sCase as short" you might report this to the scripting project at OOo, but that was obvioisly not your problem here. And we most definitely do not document a buggy behaviour. Both ways should work and both ways do work.
no further comments? => closing