FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Strange result with Xbrowse and oBrw:toexcel
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Strange result with Xbrowse and oBrw:toexcel
Posted: Tue Jul 06, 2021 09:39 PM
Using this code :

@ 880,400 BTNBMP oBtn1 OF oDlg SIZE 200, 30 NOBORDER PROMPT "Prijswijzigingen naar Exel" 2007 TOOLTIP "Tool1" ACTION exportdata(obrw4)

Code (fw): Select all Collapse
function exportdata(oBrw)
  select nofoto
  set filter to nofoto->selected
  oBrw:refresh()
  oBrw:ToExcel( NIL,NIL, { oBrw:oCol( "Id" ), oBrw:oCol( "Brandid" ), oBrw:oCol( "Benaming" ) } )
  //METHOD ToExcel( bProgress, nGroupBy, aCols, lShow, cPDF, bPrePDF ) CLASS TXBrowse
  set filter to
  oBrw:refresh()
return


I get a excel with the 3 columns = OK, but i also get 3 group headers (Webshop, Maveco, Brand)
These groupheaders are coded in xbrowse setup :

:SetGroupHeader( "Webshop", oBrw4:oCol("Shopprijs"):nCreationOrder, oBrw4:oCol("Shopmarge"):nCreationOrder )
:SetGroupHeader( "Brand", oBrw4:oCol("Bruto"):nCreationOrder, oBrw4:oCol("OudBruto"):nCreationOrder )
:SetGroupHeader( "Maveco", oBrw4:oCol("Prijs_1"):nCreationOrder, oBrw4:oCol("Marge"):nCreationOrder )

Is there a setting that ToExcel is not showing them ? I'm not sure of the options for nGroupBy values...

result of excel...

Id BrandId Benaming Webshop Maveco Brand (

1042PB LB_1042PB TROUSER 1042PB GREY 44
1043PB LB_1043PB TROUSER 1043PB WHITE 44
1052PB LB_1052PB TROUSER 1052PB GREY 44
1053PB LB_1053PB SHORTS 1053PB KHAKI 44
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Strange result with Xbrowse and oBrw:toexcel
Posted: Fri Jul 09, 2021 11:56 AM
Marc,

groupheaders
Is there a setting that ToExcel is not showing them ?


there is a switch

add to the button-action or function

button

ACTION ( oBrw4:lGrpHeader := .F. , ;
exportdata(obrw4), ;
oBrw:lGrpHeader := .T. )

or inside Your function

...
oBrw:lGrpHeader := .F. , ; // oBrw:SetGroupHeader() OFF
oBrw:ToExcel( NIL,NIL, { oBrw:oCol( "Id" ), oBrw:oCol( "Brandid" ), oBrw:oCol( "Benaming" ) } )
oBrw:lGrpHeader := .T. ) // oBrw:SetGroupHeader() ON
...

regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Strange result with Xbrowse and oBrw:toexcel
Posted: Fri Jul 09, 2021 12:44 PM

Thanks Uwe...

Marc Venken

Using: FWH 23.08 with Harbour

Continue the discussion