filas subtotalizadas en excel desde xbrowse

filas subtotalizadas en excel desde xbrowse

Postby artu01 » Mon Nov 23, 2020 8:11 pm

Mr. Rao y Gente:
Con este codigo genero este browse
Code: Select all  Expand view

  local oBrw, oRs
  TEXT INTO cSql
    SELECT Nivel1, Nivel2,TotMes01,TotMes02, TotMes03, TotMes04, TotMes05 FROM
    (
    SELECT nivel1, nivel2,  SUM( in01 ) AS TotMes01, sum(in02) as TotMes02, sum(in03) as TotMes03, sum(in04) as TotMes04, sum(in05) as TotMes05
    FROM #ping
    GROUP BY Nivel1, nivel2
    WITH ROLLUP
    ) C
    ORDER BY Nivel1, Nivel2
  ENDTEXT
  TRY
    oRs := FW_OpenRecordSet( oConnect, cSql, adLockOptimistic ) // adLockBatchOptimistic
  CATCH oError
    MsgStop( oError:Description )
  END


   aSum  := { oRs:Fields( "TotMes01" ):Value, oRs:Fields( "TotMes02" ):Value, oRs:Fields( "TotMes03" ):Value, oRs:Fields( "TotMes04" ):Value, oRs:Fields( "TotMes05" ):Value }

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-13
   DEFINE DIALOG oDlg SIZE 700,500 PIXEL TRUEPIXEL FONT oFont

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oRs AUTOCOLS ;
      CELL LINES NOBORDER FOOTERS

   WITH OBJECT oBrw
      :TotMes01:cFooter      := aSum[ 1 ]
      :TotMes02:cFooter      := aSum[ 2 ]
      :TotMes03:cFooter      := aSum[ 3 ]
      :TotMes04:cFooter      := aSum[ 4 ]
      :TotMes05:cFooter      := aSum[ 5 ]
      :AutoFit()
      :CreateFromCode()
   END
   @ 480,10 BTNBMP PROMPT "Go to Excel " SIZE 80,20 FLAT PIXEL OF oDlg ACTION oBrw:ToExcel()
   ACTIVATE DIALOG oDlg CENTERED  ;
      ON INIT ( ;
      oBrw:SetTree( 2, { FWDArrow(), FWRArrow() } ),   ;
      oBrw:bClrStds := { || { CLR_BLACK, If( oBrw:oTreeItem:nLevel == 1, 0x68DDFB, CLR_WHITE ) } } ;
      )
   RELEASE FONT oFont

return nil

 

Image

Pero quisiera llevarlo a excel y se vea subtotalizado, asi:
Image

No logro hacerlo, existe el parametro nGroupby del metodo toExcel pero no se como usarlo, uso fwh 17.12

Otra opcion seria usar el metodo subtotal de la clase TexcelScript, alguien tiene algun ejemplo?

Gracias
fwh 17.12, harbour 3.2.0, pelles C, bcc7, Ms-Sql
artu01
 
Posts: 397
Joined: Fri May 11, 2007 8:20 pm
Location: Lima

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 9 guests