Silvio wrote:I ERASE ALSO THIS LINE : Set Date British
Please add
Set Date ItalianStefan
Silvio wrote:I ERASE ALSO THIS LINE : Set Date British
Set Date ItalianI see the function CalcSubTotal() does not return a value, shouldn´t it return one ?
Dear Stefan and Silvio,
I installed OpenOffice (German Version) and run the tested with and without changing the code
ie Set Date British
It worked fine without any errors. May be it is because of the Language and Regional settings on my XP. I even tried changing the Regional Settings in Control Panel to German (Germany)
Regards
Anser
anserkk wrote:
I installed OpenOffice (German Version) and run the test without changing any code
ie I did not remove the line Set Date British
It worked fine without any errors. May be it is because of the Language and Regional settings on my XP.
Anser
Error description: Error com.sun.star.ServiceManager:CREATEINSTANCE:LOADCOMPONENTFROMURL:GETNUMBERFORMATS/3 DISP_E_MEMBERNOTFOUND: ADDNEW
Args:
[ 1] = C DD/MM/YYYY
[ 2] = O Object
StefanHaupt wrote:Silvio,
Silvio wrote:I ERASE ALSO THIS LINE : Set Date British
Please add, to get the right dateformatSet Date Italian
Application
===========
Path and name: C:\work\errori\openoffice\OCalc.Exe (32 bits)
Size: 1,797,632 bytes
Time from start: 0 hours 0 mins 9 secs
Error occurred at: 22-01-09, 16:42:43
Error description: Error com.sun.star.ServiceManager:CREATEINSTANCE:LOADCOMPONENTFROMURL:CURRENTCONTROLLER/3 DISP_E_MEMBERNOTFOUND: SELECT
Args:
[ 1] = O Object
Stack Calls
===========
Called from: source\rtl\win32ole.prg => TOLEAUTO:SELECT(0)
Called from: xbrowse.prg => TXBROWSE:TOCALC(5202)
Called from: Test.Prg => (b)MAIN(49)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK(0)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(0)
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE(0)
Called from: Test.Prg => MAIN(55)Anser,
Yes, we plan to include your code in the next FWH build.
Many thanks! ![]()
Anser,
here are the results of my tests.
Environment WindowsXP, WindowsXP64, Windows Vista (all german), OpenOffice 3 german
It´s always working with Set Date German
It´s always working with Set Date Italian
It´s not working with Set Date British
The only problem is the date format in OpenOffice, the column shows dates like "DD.06.YYYY" instead of "05.06.1991"
The only problem is the date format in OpenOffice, the column shows dates like "DD.06.YYYY" instead of "05.06.1991"
if lxlEnglish
if ValType( oCol:cEditPicture ) == 'C' .and. !( oCol:cEditPicture = '@' )
oSheet:GetColumns():GetByIndex( nCol-1 ):NumberFormat:=GetNumberFormatId(oBook, oCol:cEditPicture )
else
oSheet:GetColumns():GetByIndex( nCol-1 ):NumberFormat:=GetNumberFormatId(oBook, Set( _SET_DATEFORMAT ) )
endif
Endifif lxlEnglish
if ValType( oCol:cEditPicture ) == 'C' .and. !( oCol:cEditPicture = '@' )
oSheet:GetColumns():GetByIndex( nCol-1 ):NumberFormat:=GetNumberFormatId(oBook, oCol:cEditPicture )
else
oSheet:GetColumns():GetByIndex( nCol-1 ):NumberFormat:=GetNumberFormatId(oBook, LOWER( Set( _SET_DATEFORMAT ) ) )
endif
EndifDid you mean that Date is Displayed as "DD.06.YYYY" instead of "05.06.1991 when Set Date British is ON in your OpenOffice German version? Did Set Date British give you a run time error ?.
STATIC Function GetNumberFormatId(oBook, cNumberFormat, cColHeader, cDataType)
LOCAL cCharLocale,nFormatId
cCharLocale = oBook:GetPropertyValue("CharLocale")
nFormatId = oBook:GetNumberFormats:QueryKey(cNumberFormat, cCharLocale, .F.)
IF nFormatId = -1 // 'Format is not yet defined
TRY
nFormatId = oBook:GetNumberFormats:AddNew(cNumberFormat, cCharLocale)
CATCH
MsgInfo("Could not set the format "+cNumberFormat+" to column "+cColHeader)
IF cDataType == "D" // Date
nFormatId:=37
Endif
END
ENDIF
RETURN nFormatIdGerman : TT.MM.JJJJ
Spanish : DD/MM/AA
Portuguese : DD/MM/AA or DD.MM.AA
French : JJ/MM/AA or JJ.MM.AA
Italian : GG/MM/AAHi Anser,
the runtime error is gone now, but the format problem remains.
OpenOffice does not know a dateformat like dd.mm.yyyy, it exspects it in this form tt.mm.jjjj.
nFormatID := 37 does not solve the problem, where did you get this value from ?
It seems, the only solution is to get the langauage of the installed OpenOffice.
Now I used another class by O*a and it run ok
Perhaps if you see it you can found a solution
Silvio,
If u don't mind can I have a copy of the class which u have said. It may help me as a reference.
Stefan,
Thankyou for the feedback.
As said, I think we will have to find out the installed language and then convert dd/mm/yyyy to equivalent tt.mm.aaaa etc.
The nFormat id 37 is a API constant for date format. I thougt it will set the column to the default date format.
Unfortunately the api to check the installed language is always showing Country as US and Language as English. Can u please add the following code to the function GetNumberFormat after the line which define the cCharLocale.
msginfo(cCharLocale:Country)
Msginfo(cCharLocale:Language)
Can u tell me the values displayed via MsgInfo ?
Regards
Anser
Dear Anser,
msginfo(cCharLocale:Country) returns "DE"
Msginfo(cCharLocale:Language) returns "de"
StefanHaupt wrote:Dear Anser,
msginfo(cCharLocale:Country) returns "DE"
Msginfo(cCharLocale:Language) returns "de"