Apache OpenOffice (AOO) Bugzilla – Issue 72380
Adding a number format changes the format case.
Last modified: 2017-05-20 11:27:39 UTC
I noticed thisproblem when I added a number format containing the text "Red" to a Calc document. When I searched for the number format, I could not find it. So, I tried to add the format a second time and this causes my macro to crash because it already exists. OpenOffice continues to run, but there are two problems: 1. The macro fails. 2. It is not possible to find the key that was added. If the key is converted to upper case, the search should NOT be case sensitive. Although I have only tested this macro with a Calc document, the document type should NOT matter. Sub DoTheCrash() Dim s1$ : s1 = "#,##0.00_);[RED](#,##0.00)" Dim s2$ : s2 = "#,##0.00_);[Red](#,##0.000)" Print "Add style 1 = " & FormatStyleCrash(s1, ThisComponent) Print "Check style 1 = " & FormatStyleCrash(s1, ThisComponent) Print "Add style 2 = " & FormatStyleCrash(s2, ThisComponent) Print "Check style 2 = " & FormatStyleCrash(s2, ThisComponent) End Sub Function FormatStyleCrash(sFormat, oDoc) Dim aLocale As New com.sun.star.lang.Locale Dim oFormats As Object Dim formatNum As Integer oFormats = oDoc.getNumberFormats() formatNum = oFormats.queryKey(sFormat, aLocale, True) 'MsgBox "Current Format number is" & formatNum 'If the number format does not exist then add it If (formatNum = -1) Then 'Print "Ready to add format " & sFormat formatNum = oFormats.addNew(sFormat, aLocale) If (formatNum = -1) Then formatNum = 0 'MsgBox "new Format number is " & formatNum End If FormatStyleCrash = formatNum End Function
jsc -> nn: can check and comment this please
Reset assigne to the default "issues@openoffice.apache.org".