Hi,
I'm trying to set a cell to show numbers to two decimal places and I've found various bits of code around but nothing works for me.
I currently have:
some of this is likely redundant, or simply wrong, but as it stands it doesn't throw any errors...
but it doesn't do anything either.
Any suggestions please?
Regards
Peter
I'm trying to set a cell to show numbers to two decimal places and I've found various bits of code around but nothing works for me.
I currently have:
Code:
Dim oCell As Object
Set oCell = oSheet.getCellByPosition(1, 1)
Call oCell.setvalue(1000)
Dim NumberFormats As Object
Dim NumberFormatString As Object
Dim FormatVal As Object
Dim Loc As Object
Set Loc = oSM.Bridge_GetStruct("com.sun.star.lang.locale")
Dim FormatID As Long
'Set NumberFormatString = oDoc.GetNumberFormats()
Set NumberFormatString = oDoc.NumberFormats
FormatID = NumberFormats.queryKey(f, Loc, False)
If FormatID = -1 Then
FormatID = NumberFormats.AddNew(f, Loc)
End If
GetFormat = FormatID
Call oCell.NumberFormatString("#.##0.00")
some of this is likely redundant, or simply wrong, but as it stands it doesn't throw any errors...
but it doesn't do anything either.
Any suggestions please?
Regards
Peter