Linares,
Is there any parameter to reset all the numeric formats xBrowse for Brazilian (999,999.99) standard?
If so this parameter also changes the format of the exported to Excel numbers?
OASyS Informática
Fwh18.02 + xHarbour 1.2.3 + Bcc72
Linares,
Is there any parameter to reset all the numeric formats xBrowse for Brazilian (999,999.99) standard?
If so this parameter also changes the format of the exported to Excel numbers?
XBrowse (and FWH in general) support 3 kinds of numeric formats, which can be automatically reset during execution, if we do not hard-code numeric formats in our xbrowse program.
A. American format used by most countries "999,999,999.99"
E. European format "999.999.999,99", widely used in Europe
I. Indian forat: "99,99,999.99" used in Indian sub-continent.
To set / change the format, call the function:
FWNumFormat( cInternational, ; // 'A' or 'E' .or. 'I"
lUseThousandSep )
It is desirable to set the format at the beginning of the program
Example:
FWNumFormat( 'A', .t. )
XBrowse automatically builds picture clause of Numeric data on the basis of this specification, appropriate the Field Length and Field Decimals, if "we do not" provide hard-coded formats.
Thanks Rao,
I used FwNumFormat ('E',. T.) and, in fact, the numbers in xBrowse already were properly disposed.
However, when exporting to Excel does not recognize the formatting.
Example: Number [12,1234] (two integers and four decimal) exported [121.234,0000] (six integers and four decimal) to excel.
#include 'fivewin.ch'
#include 'xbrowse.ch'
function Main()
local oWnd, oBar, oBrw, nTotal:=0
/*
A. American format: "999,999,999.99"
E. European format: "999.999.999,99"
I. Indian format: "99,99,999.99"
*/
FwNumFormat( 'E', .T. ) // European Format
DBCREATE("TESTXLS",{{"DESC ","C",010,000},;
{"VAL1 ","N",010,001},;
{"VAL2 ","N",010,002},;
{"VAL3 ","N",010,003},;
{"VAL4 ","N",010,004},;
{"VAL5 ","N",010,005}})
USE TESTXLS NEW ALIAS TESTXLS
FOR nTotal=1 To 20
APPEND BLANK
REPL DESC WITH "Linha "+STRZERO(nTotal,2)
REPL VAL1 WITH 99999 * nTotal / 777
REPL VAL2 WITH 99999 * nTotal / 777
REPL VAL3 WITH 99999 * nTotal / 777
REPL VAL4 WITH 99999 * nTotal / 777
REPL VAL5 WITH 99999 * nTotal / 777
NEXT
DEFINE WINDOW ownd
DEFINE BUTTONBAR oBar OF oWnd SIZE 80,32 2007
DEFINE BUTTON OF oBar PROMPT 'Excel' ;
ACTION MsgMeter( { |oMeter, oText, oDlg, lEnd | ;
Export2Excel( oBrw, oMeter, oText, oDlg, @lEnd ) } )
DEFINE BUTTON OF oBar PROMPT 'Quit' ACTION WndMain():End()
SET MESSAGE OF oWnd TO '' 2007
@ 0,0 XBROWSE oBrw OF oWnd ALIAS 'TESTXLS' AUTOCOLS CELL LINES
// Realmente nao funciona quando exporto para o Broffice/Excel
oBrw:aCols[2]:bFooter = {|| TRANSFORM(Field->VAL1, "@E 9.999.999,99") }
oBrw:aCols[3]:bFooter = {|| TRANSFORM(Field->VAL2, "@E 9.999.999,99") }
oBrw:aCols[4]:bFooter = {|| TRANSFORM(Field->VAL3, "@E 9.999.999,99") }
oBrw:aCols[5]:bFooter = {|| TRANSFORM(Field->VAL4, "@E 9.999.999,99") }
oBrw:aCols[6]:bFooter = {|| TRANSFORM(Field->VAL5, "@E 9.999.999,99") }
oBrw:MakeTotals()
oBrw:refresh()
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd MAXIMIZED
CLOSE DATA
return nil
static function Export2Excel( oBrw, oMeter, oText, oDlg, lEnd )
oBrw:ToExcel( { |n,t| oMeter:nTotal := t, ;
oMeter:Set( n ), ;
oText:SetText( Str(n) + '/' + Str(t) ), ;
oDlg:Update(), .t. } )
return nil