Anser,
yes, "DE" stands for german, I forgot to mention it.
For the other languages I´m not sure
Spanish - "ES"
Portuguese - "PT"
Italian - "IT" ?
French - "FR" ?
anserkk wrote:The nFormat id 37 is a API constant for date format. I thougt it will set the column to the default date format.
STATIC Function GetNumberFormatId(oBook, cNumberFormat, cColHeader, cDataType)
LOCAL cCharLocale,nFormatId
cCharLocale = oBook:GetPropertyValue("CharLocale")
IF cDataType == "D" // Date
cNumberFormat:=Upper(cNumberFormat)
IF cCharLocale:Language == "es" .or. cCharLocale:Language == "pt" .or. cCharLocale:Language == "it" // Spanish,Portuguese,Italian
cNumberFormat:=StrTran(cNumberFormat,"Y","A") // All Y should be replaced to A
ELSEIF cCharLocale:Language == "de" // German
cNumberFormat:=StrTran(cNumberFormat,"D","T") // All D should be replaced to T
cNumberFormat:=StrTran(cNumberFormat,"Y","J") // All Y should be replaced to J
elseif cCharLocale:Language == "fr" // French
cNumberFormat:=StrTran(cNumberFormat,"D","J") // All D should be replaced to J
cNumberFormat:=StrTran(cNumberFormat,"Y","A") // All Y should be replaced to A
Endif
Endif
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 nFormatId
can you tell me the Url, where the API is located ?
Format index
Some index values:
0 => Standard
11 => Per cent
37 => Date
41 => Hour
60 => Scientific notation
70 => Fraction
99 => Boolean
100 => Text
105 => Personal
106 => Currency
But there's a lot more to find out )
com.sun.star.util.NumberFormat.DEFINED
com.sun.star.util.NumberFormat.DATE
com.sun.star.util.NumberFormat.TIME
com.sun.star.util.NumberFormat.CURRENCY
com.sun.star.util.NumberFormat.NUMBER
com.sun.star.util.NumberFormat.SCIENTIFIC
com.sun.star.util.NumberFormat.FRACTION
com.sun.star.util.NumberFormat.PERCENT
com.sun.star.util.NumberFormat.TEXT
com.sun.star.util.NumberFormat.DATETIME
com.sun.star.util.NumberFormat.LOGICAL
com.sun.star.util.NumberFormat.UNDEFINED
com.sun.star.util.NumberFormat.ALL
Application
===========
Path and name: D:\XBase\XHarbour\!XBrowse\OpenOffice\OCalc.exe (32 bits)
Size: 1,794,048 bytes
Time from start: 0 hours 0 mins 1 secs
Error occurred at: 27-01-2009, 12:17:57
Error description: Error BASE/1132 Bound error: array access
Args:
[ 1] = A { ... }
[ 2] = N 5
Stack Calls
===========
Called from: xbrowse9.prg => PASTEUNFORMATTEDTEXT(5416)
Called from: xbrowse9.prg => TXBROWSE:TOCALC(5185)
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)
Called from: xbrowse9.prg => PASTEUNFORMATTEDTEXT(5416)
anserkk wrote:Can you tell me what is exactly on Line No:5416 on xBrowse
DO while i <= Len(oClipContent)
if oClipContent[i] = 0 .OR. oClipContent[i] = 13 .OR. oClipContent[i] = 10
oCol:=aCols[nCol+1]
if lFullRow
for n := 1 to nLast
if ! ::aCols[ n ]:lHide
// if ! Empty( RetVal )
// RetVal += Chr( 9 )
// endif
RetVal += strtran( ::aCols[ n ]:ClpText, CRLF, " ; " ) + Chr( 9 )
endif
next
else
RetVal := StrTran( ::SelectedCol():ClpText, CRLF, " ; " )
endif
if lFullRow
for n := 1 to nLast
if ! ::aCols[ n ]:lHide
if ! Empty( RetVal )
RetVal += Chr( 9 )
endif
RetVal += ::aCols[ n ]:ClpText
endif
next
else
RetVal := ::SelectedCol():ClpText
endif
STATIC Function PasteUnformattedText(oCalc,oBook,oSheet,aCols)
LOCAL oClipContType,oClipContent,oClip,cStr,i,nClipColNo
LOCAL lFound,nRow,nCol,k,oCol
oClip = oCalc:CreateInstance("com.sun.star.datatransfer.clipboard.SystemClipboard")
oClipContType = oClip:Contents:getTransferDataFlavors
lFound = .F. ; i:= 1
DO while i <= Len(oClipContType) .AND. !lFound
if oClipContType[i]:HumanPresentableName = "OEM/ANSI Text"
lFound = .T.
k:=i
else
i:=i + 1
endif
Enddo
if lFound
nRow = oBook:CurrentSelection:getRangeAddress():startrow
oClipContent:=oClip:Contents:getTransferData( oClipContType[k] )
i:=1 ; cStr:="" ; nCol:=0
DO while i <= Len(oClipContent)
if oClipContent[i] = 0 .OR. oClipContent[i] = 13 .OR. oClipContent[i] = 10
i=i+2 ; nRow:=nRow + 1 ; cStr:="" ; nCol:=0
ELSEIF oClipContent[i] = 9 // Tab
oCol:=aCols[nCol+1]
IF oCol:cDataType == "C"
oSheet:getCellByposition(nCol,nRow):SetString(cStr)
ELSEIF oCol:cDataType == "N"
oSheet:getCellByposition(nCol,nRow):SetValue(cStr)
ELSEIF oCol:cDataType == "D"
oSheet:getCellByposition(nCol,nRow):SetFormula(cStr)
ELSE
oSheet:getCellByposition(nCol,nRow):SetString(cStr)
Endif
nCol:=nCol+1 ; cStr:="" ; i:=i+1
else
cStr:=cStr + chr(oClipContent[i])
i:=i+1
endif
Enddo
endif
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 57 guests