FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Una de ToExcel() desde xBrowse
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Una de ToExcel() desde xBrowse
Posted: Tue Jun 01, 2010 03:33 PM
Hola a todos

como se hace para mandar los valores con formato desde Xbrowse con array
hago lo siguiente:
Code (fw): Select all Collapse
  oBrw5:=TXBrowse():New( oDlg5 )
   oBrw5:nMarqueeStyle := MARQSTYLE_HIGHLROW
  oBrw5:nColDividerStyle:=LINESTYLE_LIGHTGRAY
   oBrw5:nRowDividerStyle:=LINESTYLE_LIGHTGRAY
   oBrw5:lHScroll:=.T.
  oBrw5:SetArray( aDetallada, .T. )   
  oBrw5:lFooter=.T.

 oBrw5:aCols[1]:cHeader := "HB.BASICO"
 oBrw5:aCols[1]:nWidth:=69
 oBrw5:aCols[1]:cEditPicture:="9,999,999.99"
 oBrw5:aCols[1]:bfooter:={|| Trans(TOTAL,"9,999,999.99") }

Y como hacer para que vaya tambien el total

Gracias por la ayuda

Saludos

Adhemar
Saludos,



Adhemar C.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Una de ToExcel() desde xBrowse
Posted: Tue Jun 01, 2010 05:12 PM
Code (fw): Select all Collapse
oBrw5:aCols[1]:lTotal := .t.

This informs xBrowse to include Sum formula for the column while exporting to excel.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Una de ToExcel() desde xBrowse
Posted: Tue Jun 01, 2010 05:17 PM
This is a much simpler way to handle totals in xbrowse.
Code (fw): Select all Collapse
#include 'fivewin.ch'
#include 'xbrowse.ch'

function Main()

   local oDlg, oBrw
   local aData := { { 1, 3000 }, { 2, 5000 }, { 3, 6000 } }

   DEFINE DIALOG oDlg SIZE 200,300 PIXEL

   @ 10,10 XBROWSE oBrW SIZE -10,-30 PIXEL OF oDlg ;
      AUTOCOLS ;
      HEADERS 'Day', 'Sales' ;
      PICTURES '99', '99,999' ;
      ARRAY aData CELL LINES FOOTERS NOBORDER

   oBrw:Sales:nFooterType := AGGR_SUM  // ver 10.2 and later
   // for versions 10.1 and earlier
   // oBrw:lTotal := .t.
   // oBrw:nTotal := 0

   oBrw:nStretchCol       := 2
   oBrw:MakeTotals()
   oBrw:CreateFromCode()

   @ 130, 10 BUTTON 'Excel' SIZE 40,12 PIXEL OF oDlg ;
      ACTION oBrw:ToExcel()

   ACTIVATE DIALOG oDlg CENTERED

return nil

XBrowse totals automatically and shows the formatted total in the footer. Also exports SUM formula to Excel and also while printing by Report method.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM
Re: Una de ToExcel() desde xBrowse
Posted: Tue Jun 01, 2010 06:54 PM

Thanks G. N. Rao.

No funciona ninguna de las formas de los totales, me parece que es por mi version FWH 9.04

Lo de los totales lo puedo hacer manual.

Necesito que las columnas numericas vayan con formato, me muestra sin decimales.

Gracias por la ayuda

Saludos

Adhemar

Saludos,



Adhemar C.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Una de ToExcel() desde xBrowse
Posted: Wed Jun 02, 2010 07:44 AM

oCol:ltotal, oCol:nTotal and oBrw:MakeTotals() work from 9.3 onwards.

You can total yourself. In that case, assign the total to oCol:nTotal. oCol:ntotal is displayed in the footer using the oCol:cEditPicture, if any, or using cValToChar( oCol:ntotal ). Normally there is no need to assign codeblock with Transform.

If we specify oCol:lTotal := .t., XBrowse places SUM(..) formula in in ToExcel() method and totals the column in Report method.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion